Merge lp://staging/~jkakar/storm/coalesce-expr into lp://staging/storm

Proposed by Jamu Kakar
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~jkakar/storm/coalesce-expr
Merge into: lp://staging/storm
Diff against target: 40 lines
To merge this branch: bzr merge lp://staging/~jkakar/storm/coalesce-expr
Reviewer Review Type Date Requested Status
James Henstridge Approve
Gustavo Niemeyer Approve
Review via email: mp+9227@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Looks good! +1!

review: Approve
Revision history for this message
James Henstridge (jamesh) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storm/expr.py'
2--- storm/expr.py 2009-07-10 05:08:49 +0000
3+++ storm/expr.py 2009-07-23 23:20:11 +0000
4@@ -1238,6 +1238,11 @@
5 name = "UPPER"
6
7
8+class Coalesce(NamedFunc):
9+ __slots__ = ()
10+ name = "COALESCE"
11+
12+
13 # --------------------------------------------------------------------
14 # Prefix and suffix expressions
15
16
17=== modified file 'tests/expr.py'
18--- tests/expr.py 2009-07-10 05:08:49 +0000
19+++ tests/expr.py 2009-07-23 23:20:11 +0000
20@@ -1316,6 +1316,20 @@
21 self.assertEquals(statement, "UPPER(func1())")
22 self.assertEquals(state.parameters, [])
23
24+ def test_coalesce(self):
25+ expr = Coalesce(Func1())
26+ state = State()
27+ statement = compile(expr, state)
28+ self.assertEquals(statement, "COALESCE(func1())")
29+ self.assertEquals(state.parameters, [])
30+
31+ def test_coalesce_with_many_arguments(self):
32+ expr = Coalesce(Func1(), Func2(), None)
33+ state = State()
34+ statement = compile(expr, state)
35+ self.assertEquals(statement, "COALESCE(func1(), func2(), NULL)")
36+ self.assertEquals(state.parameters, [])
37+
38 def test_not(self):
39 expr = Not(Func1())
40 state = State()

Subscribers

People subscribed via source and target branches

to status/vote changes: