summaryrefslogtreecommitdiff
path: root/test/sql/test_operators.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-04-01 13:03:52 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-04-01 13:03:52 -0400
commit2e5c8913a8e15e649322c0907199361df9698153 (patch)
tree1c87108bf0e47734d14e7bf4f868f0d8e626ffd9 /test/sql/test_operators.py
parente16ede8cae00fd5cbbd5fb33d63c14df0153c2bc (diff)
downloadsqlalchemy-2e5c8913a8e15e649322c0907199361df9698153.tar.gz
- Fixes to the newly enhanced boolean coercion in :ticket:`2804` where
the new rules for "where" and "having" woudn't take effect for the "whereclause" and "having" kw arguments of the :func:`.select` construct, which is also what :class:`.Query` uses so wasn't working in the ORM either. fixes #3013 re: #2804
Diffstat (limited to 'test/sql/test_operators.py')
-rw-r--r--test/sql/test_operators.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py
index 31af7d273..63475fcef 100644
--- a/test/sql/test_operators.py
+++ b/test/sql/test_operators.py
@@ -439,7 +439,7 @@ class BooleanEvalTest(fixtures.TestBase, testing.AssertsCompiledSQL):
dialect=self._dialect(True)
)
- def test_two(self):
+ def test_two_a(self):
c = column('x', Boolean)
self.assert_compile(
select([c]).where(c),
@@ -447,7 +447,15 @@ class BooleanEvalTest(fixtures.TestBase, testing.AssertsCompiledSQL):
dialect=self._dialect(False)
)
- def test_three(self):
+ def test_two_b(self):
+ c = column('x', Boolean)
+ self.assert_compile(
+ select([c], whereclause=c),
+ "SELECT x WHERE x = 1",
+ dialect=self._dialect(False)
+ )
+
+ def test_three_a(self):
c = column('x', Boolean)
self.assert_compile(
select([c]).where(~c),
@@ -455,6 +463,14 @@ class BooleanEvalTest(fixtures.TestBase, testing.AssertsCompiledSQL):
dialect=self._dialect(False)
)
+ def test_three_b(self):
+ c = column('x', Boolean)
+ self.assert_compile(
+ select([c], whereclause=~c),
+ "SELECT x WHERE x = 0",
+ dialect=self._dialect(False)
+ )
+
def test_four(self):
c = column('x', Boolean)
self.assert_compile(
@@ -463,7 +479,7 @@ class BooleanEvalTest(fixtures.TestBase, testing.AssertsCompiledSQL):
dialect=self._dialect(True)
)
- def test_five(self):
+ def test_five_a(self):
c = column('x', Boolean)
self.assert_compile(
select([c]).having(c),
@@ -471,6 +487,14 @@ class BooleanEvalTest(fixtures.TestBase, testing.AssertsCompiledSQL):
dialect=self._dialect(False)
)
+ def test_five_b(self):
+ c = column('x', Boolean)
+ self.assert_compile(
+ select([c], having=c),
+ "SELECT x HAVING x = 1",
+ dialect=self._dialect(False)
+ )
+
def test_six(self):
self.assert_compile(
or_(false(), true()),