From: Mike Bayer Date: Wed, 29 Jan 2014 19:55:58 +0000 (-0500) Subject: - add TypeError handling to the tests here, ensure TypeError X-Git-Tag: rel_0_9_2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7d56e4f135bd574aed25eacf1f5fbcfe3ffbdab9;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - add TypeError handling to the tests here, ensure TypeError for the control is a TypeError for the row, as is raised on py3k when less/greater operators are used on incompatible types --- diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 8cbd01c661..799fbf3bc3 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -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