summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sets.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_sets.py')
-rw-r--r--Lib/test/test_sets.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/Lib/test/test_sets.py b/Lib/test/test_sets.py
index 85e4a22..88cfcac 100644
--- a/Lib/test/test_sets.py
+++ b/Lib/test/test_sets.py
@@ -234,11 +234,8 @@ class TestBinaryOps(unittest.TestCase):
a, b = Set('a'), Set('b')
self.assertRaises(TypeError, cmp, a, b)
- # You can view this as a buglet: cmp(a, a) does not raise TypeError,
- # because __eq__ is tried before __cmp__, and a.__eq__(a) returns True,
- # which Python thinks is good enough to synthesize a cmp() result
- # without calling __cmp__.
- self.assertEqual(cmp(a, a), 0)
+ # In py3k, this works!
+ self.assertRaises(TypeError, cmp, a, a)
self.assertRaises(TypeError, cmp, a, 12)
self.assertRaises(TypeError, cmp, "abc", a)
@@ -675,8 +672,8 @@ class TestCopying(unittest.TestCase):
def test_copy(self):
dup = self.set.copy()
- dup_list = list(dup); dup_list.sort()
- set_list = list(self.set); set_list.sort()
+ dup_list = sorted(dup, key=repr)
+ set_list = sorted(self.set, key=repr)
self.assertEqual(len(dup_list), len(set_list))
for i in range(len(dup_list)):
self.failUnless(dup_list[i] is set_list[i])
@@ -684,8 +681,8 @@ class TestCopying(unittest.TestCase):
def test_deep_copy(self):
dup = copy.deepcopy(self.set)
##print type(dup), repr(dup)
- dup_list = list(dup); dup_list.sort()
- set_list = list(self.set); set_list.sort()
+ dup_list = sorted(dup, key=repr)
+ set_list = sorted(self.set, key=repr)
self.assertEqual(len(dup_list), len(set_list))
for i in range(len(dup_list)):
self.assertEqual(dup_list[i], set_list[i])