summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-04-22 19:12:47 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-04-22 19:12:47 -0400
commit5884c2e7e5b46cee29b90aa3f7161e7380e3e2a5 (patch)
treeed8a37934eb00d4c01bfeec117ea7b1bb980db68 /test/sql
parent63c211f42730011760aa8e3f88b2171b23bc0a60 (diff)
downloadsqlalchemy-5884c2e7e5b46cee29b90aa3f7161e7380e3e2a5.tar.gz
Fully implemented the IS and IS NOT operators with
regards to the True/False constants. An expression like ``col.is_(True)`` will now render ``col IS true`` on the target platform, rather than converting the True/ False constant to an integer bound parameter. This allows the ``is_()`` operator to work on MySQL when given True/False constants. [ticket:2682]
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_operators.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py
index 7215ae565..d1db733e0 100644
--- a/test/sql/test_operators.py
+++ b/test/sql/test_operators.py
@@ -1,7 +1,7 @@
from sqlalchemy.testing import fixtures, eq_, is_
from sqlalchemy import testing
from sqlalchemy.testing import assert_raises_message
-from sqlalchemy.sql import column, desc, asc, literal, collate
+from sqlalchemy.sql import column, desc, asc, literal, collate, null, true, false
from sqlalchemy.sql.expression import BinaryExpression, \
ClauseList, Grouping, \
UnaryExpression, select, union, func, tuple_
@@ -66,6 +66,33 @@ class DefaultColumnComparatorTest(fixtures.TestBase):
def test_isnot_null(self):
self._do_operate_test(operators.isnot, None)
+ def test_is_null_const(self):
+ self._do_operate_test(operators.is_, null())
+
+ def test_is_true_const(self):
+ self._do_operate_test(operators.is_, true())
+
+ def test_is_false_const(self):
+ self._do_operate_test(operators.is_, false())
+
+ def test_equals_true(self):
+ self._do_operate_test(operators.eq, True)
+
+ def test_notequals_true(self):
+ self._do_operate_test(operators.ne, True)
+
+ def test_is_true(self):
+ self._do_operate_test(operators.is_, True)
+
+ def test_isnot_true(self):
+ self._do_operate_test(operators.isnot, True)
+
+ def test_is_false(self):
+ self._do_operate_test(operators.is_, False)
+
+ def test_isnot_false(self):
+ self._do_operate_test(operators.isnot, False)
+
def test_like(self):
self._do_operate_test(operators.like_op)