#7092 - Silence more py3k deprecation warnings, using test_support.check_py3k_warnings() helper.
diff --git a/Lib/test/test_sets.py b/Lib/test/test_sets.py
index ca049a4..0754ed7 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 @@
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 @@
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 @@
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):