Merged revisions 79165 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79165 | florent.xicluna | 2010-03-21 03:14:24 +0200 (Sun, 21 Mar 2010) | 2 lines
#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 efa388f..53c30be 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,11 +681,12 @@
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.failUnless(dup_list[i] is set_list[i])
+ for i, el in enumerate(dup_list):
+ self.assertTrue(el is set_list[i])
def test_deep_copy(self):
dup = copy.deepcopy(self.set)
@@ -694,6 +697,7 @@
for i in range(len(dup_list)):
self.assertEqual(dup_list[i], set_list[i])
+
#------------------------------------------------------------------------------
class TestCopyingEmpty(TestCopying):
@@ -712,6 +716,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):