diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-01-08 18:41:40 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-01-08 18:41:40 (GMT) |
commit | 3ddc435af6873c6304058d7bcbcb19ee4fba7781 (patch) | |
tree | c7a03cf0a8b856bae2ebebba55b09f775845c7ca /Lib/test/test_sets.py | |
parent | 3194d1454cbc11ec477d83fff3fc749972107d29 (diff) | |
download | cpython-3ddc435af6873c6304058d7bcbcb19ee4fba7781.zip cpython-3ddc435af6873c6304058d7bcbcb19ee4fba7781.tar.gz cpython-3ddc435af6873c6304058d7bcbcb19ee4fba7781.tar.bz2 |
Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. Patch by flox
Diffstat (limited to 'Lib/test/test_sets.py')
-rw-r--r-- | Lib/test/test_sets.py | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/Lib/test/test_sets.py b/Lib/test/test_sets.py index 9c59836..754ceb1 100644 --- a/Lib/test/test_sets.py +++ b/Lib/test/test_sets.py @@ -510,15 +510,17 @@ class TestOnlySetsInBinaryOps(unittest.TestCase): self.assertEqual(self.set != self.other, True) def test_ge_gt_le_lt(self): - self.assertRaises(TypeError, lambda: self.set < self.other) - self.assertRaises(TypeError, lambda: self.set <= self.other) - self.assertRaises(TypeError, lambda: self.set > self.other) - self.assertRaises(TypeError, lambda: self.set >= self.other) - - self.assertRaises(TypeError, lambda: self.other < self.set) - self.assertRaises(TypeError, lambda: self.other <= self.set) - self.assertRaises(TypeError, lambda: self.other > self.set) - self.assertRaises(TypeError, lambda: self.other >= self.set) + # Silence Py3k warning + with test_support.check_warnings(): + self.assertRaises(TypeError, lambda: self.set < self.other) + self.assertRaises(TypeError, lambda: self.set <= self.other) + self.assertRaises(TypeError, lambda: self.set > self.other) + self.assertRaises(TypeError, lambda: self.set >= self.other) + + self.assertRaises(TypeError, lambda: self.other < self.set) + self.assertRaises(TypeError, lambda: self.other <= self.set) + self.assertRaises(TypeError, lambda: self.other > self.set) + self.assertRaises(TypeError, lambda: self.other >= self.set) def test_union_update_operator(self): try: @@ -679,20 +681,20 @@ 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 = list(dup) + set_list = list(self.set) self.assertEqual(len(dup_list), len(set_list)) - for i in range(len(dup_list)): - self.assertTrue(dup_list[i] is set_list[i]) + for elt in dup_list: + self.assertTrue(elt in set_list) 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 = list(dup) + set_list = list(self.set) self.assertEqual(len(dup_list), len(set_list)) - for i in range(len(dup_list)): - self.assertEqual(dup_list[i], set_list[i]) + for elt in dup_list: + self.assertTrue(elt in set_list) #------------------------------------------------------------------------------ |