summaryrefslogtreecommitdiff
path: root/test/base/test_utils.py
diff options
context:
space:
mode:
authorDiana Clarke <diana.joan.clarke@gmail.com>2012-11-14 23:25:09 -0500
committerDiana Clarke <diana.joan.clarke@gmail.com>2012-11-14 23:25:09 -0500
commit8a4ab8a4db3b9fb773302e4e8c1e80b24f13fec4 (patch)
tree1709e476225a703d5102fa361536d165fcc3febc /test/base/test_utils.py
parent94f8a792aad93f912d2e5b05cee7aafd8935470d (diff)
downloadsqlalchemy-8a4ab8a4db3b9fb773302e4e8c1e80b24f13fec4.tar.gz
oops! python 3 doesn't do the rich comparison cmp thing
Diffstat (limited to 'test/base/test_utils.py')
-rw-r--r--test/base/test_utils.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/test/base/test_utils.py b/test/base/test_utils.py
index 06a91b62b..8f5bffd43 100644
--- a/test/base/test_utils.py
+++ b/test/base/test_utils.py
@@ -345,8 +345,7 @@ class IdentitySetTest(fixtures.TestBase):
def should_raise():
not_an_identity_set = object()
return unique1 <= not_an_identity_set
- assert_raises_message(
- TypeError, 'cannot compare sets using cmp()', should_raise)
+ self._assert_unorderable_types(should_raise)
def test_dunder_lt(self):
super_, sub_, twin1, twin2, unique1, unique2 = self._create_sets()
@@ -367,8 +366,7 @@ class IdentitySetTest(fixtures.TestBase):
def should_raise():
not_an_identity_set = object()
return unique1 < not_an_identity_set
- assert_raises_message(
- TypeError, 'cannot compare sets using cmp()', should_raise)
+ self._assert_unorderable_types(should_raise)
def test_dunder_ge(self):
super_, sub_, twin1, twin2, unique1, unique2 = self._create_sets()
@@ -389,8 +387,7 @@ class IdentitySetTest(fixtures.TestBase):
def should_raise():
not_an_identity_set = object()
return unique1 >= not_an_identity_set
- assert_raises_message(
- TypeError, 'cannot compare sets using cmp()', should_raise)
+ self._assert_unorderable_types(should_raise)
def test_dunder_gt(self):
super_, sub_, twin1, twin2, unique1, unique2 = self._create_sets()
@@ -411,8 +408,7 @@ class IdentitySetTest(fixtures.TestBase):
def should_raise():
not_an_identity_set = object()
return unique1 > not_an_identity_set
- assert_raises_message(
- TypeError, 'cannot compare sets using cmp()', should_raise)
+ self._assert_unorderable_types(should_raise)
def test_issubset(self):
super_, sub_, twin1, twin2, unique1, unique2 = self._create_sets()
@@ -712,6 +708,15 @@ class IdentitySetTest(fixtures.TestBase):
unique2 = util.IdentitySet([o5])
return super_, sub_, twin1, twin2, unique1, unique2
+ def _assert_unorderable_types(self, callable_):
+ # Py3K
+ #assert_raises_message(
+ # TypeError, 'unorderable types', callable_)
+ # Py2K
+ assert_raises_message(
+ TypeError, 'cannot compare sets using cmp()', callable_)
+ # end Py2K
+
def test_basic_sanity(self):
IdentitySet = util.IdentitySet