diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-21 01:14:24 +0000 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-21 01:14:24 +0000 |
commit | 07627880813ffaad8d9b90bfe8791ccf588b031b (patch) | |
tree | 14fbe48b451085257da7c79781999cc86729c74f /Lib/test/test_sets.py | |
parent | 8cb253f8d6333af0a575d5951379c090752c0fc6 (diff) | |
download | cpython-git-07627880813ffaad8d9b90bfe8791ccf588b031b.tar.gz |
#7092 - Silence more py3k deprecation warnings, using test_support.check_py3k_warnings() helper.
Diffstat (limited to 'Lib/test/test_sets.py')
-rw-r--r-- | Lib/test/test_sets.py | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/Lib/test/test_sets.py b/Lib/test/test_sets.py index ca049a4e69..0754ed74fc 100644 --- a/Lib/test/test_sets.py +++ b/Lib/test/test_sets.py @@ -1,13 +1,11 @@ #!/usr/bin/env python -import warnings -warnings.filterwarnings("ignore", "the sets module is deprecated", - DeprecationWarning, "test\.test_sets") - import unittest, operator, copy, pickle, random -from sets import Set, ImmutableSet from test import test_support +test_support.import_module("sets", deprecated=True) +from sets import Set, ImmutableSet + empty_set = Set() #============================================================================== @@ -638,6 +636,10 @@ class TestOnlySetsOperator(TestOnlySetsInBinaryOps): self.other = operator.add self.otherIsIterable = False + def test_ge_gt_le_lt(self): + with test_support.check_py3k_warnings(): + super(TestOnlySetsOperator, self).test_ge_gt_le_lt() + #------------------------------------------------------------------------------ class TestOnlySetsTuple(TestOnlySetsInBinaryOps): @@ -679,20 +681,16 @@ 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() + self.assertEqual(len(dup), len(self.set)) + dup_list = sorted(dup) + set_list = sorted(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 i, el in enumerate(dup_list): + self.assertIs(el, set_list[i]) 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() - self.assertEqual(len(dup_list), len(set_list)) - for i in range(len(dup_list)): - self.assertEqual(dup_list[i], set_list[i]) + self.assertSetEqual(dup, self.set) #------------------------------------------------------------------------------ @@ -712,6 +710,10 @@ class TestCopyingTriple(TestCopying): def setUp(self): self.set = Set(["zero", 0, None]) + def test_copy(self): + with test_support.check_py3k_warnings(): + super(TestCopyingTriple, self).test_copy() + #------------------------------------------------------------------------------ class TestCopyingTuple(TestCopying): |