]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add TypeError handling to the tests here, ensure TypeError
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 29 Jan 2014 19:55:58 +0000 (14:55 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 29 Jan 2014 19:55:58 +0000 (14:55 -0500)
for the control is a TypeError for the row, as is raised on py3k when
less/greater operators are used on incompatible types

test/sql/test_query.py

index 8cbd01c6615f0f9b48ee237841a3da06b2332b8c..799fbf3bc31c821ebca2f1aa3ae3effb4f127f9b 100644 (file)
@@ -331,14 +331,21 @@ class QueryTest(fixtures.TestBase):
                 operator.eq, operator.ne, operator.gt,
                 operator.lt, operator.ge, operator.le
             ]:
-                eq_(
-                    op(equal, compare),
-                    op(rp, compare)
-                )
-                eq_(
-                    op(compare, equal),
-                    op(compare, rp)
-                )
+
+                try:
+                    control = op(equal, compare)
+                    eq_(control, op(rp, compare))
+                except TypeError:
+                    # Py3K raises TypeError for some invalid comparisons
+                    assert_raises(TypeError, op, rp, compare)
+
+                try:
+                    control = op(compare, equal)
+                    eq_(control, op(compare, rp))
+                except TypeError:
+                    # Py3K raises TypeError for some invalid comparisons
+                    assert_raises(TypeError, op, compare, rp)
+
 
 
     @testing.provide_metadata