summaryrefslogtreecommitdiff
path: root/Lib/test/test_set.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2010-08-03 08:41:02 +0000
committerEzio Melotti <ezio.melotti@gmail.com>2010-08-03 08:41:02 +0000
commit5c75235d3254be293e8288532ec214aa0702c335 (patch)
tree16ab7bd56127d781776fc2891e60160812da583e /Lib/test/test_set.py
parentffd0b8892e797a719c96a22f81546f49f4e2b4e5 (diff)
downloadcpython-git-5c75235d3254be293e8288532ec214aa0702c335.tar.gz
Fix deprecation warnings in test_set.py
Diffstat (limited to 'Lib/test/test_set.py')
-rw-r--r--Lib/test/test_set.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index 86e8b9b170..3539a14065 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -1385,8 +1385,9 @@ 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()
+ with test_support.check_warnings():
+ 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])
@@ -1394,8 +1395,9 @@ 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()
+ with test_support.check_warnings():
+ 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.assertEqual(dup_list[i], set_list[i])
@@ -1557,8 +1559,9 @@ class TestVariousIteratorArgs(unittest.TestCase):
def test_constructor(self):
for cons in (set, frozenset):
for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)):
- for g in (G, I, Ig, S, L, R):
- self.assertEqual(sorted(cons(g(s))), sorted(g(s)))
+ with test_support.check_warnings():
+ for g in (G, I, Ig, S, L, R):
+ self.assertEqual(sorted(cons(g(s))), sorted(g(s)))
self.assertRaises(TypeError, cons , X(s))
self.assertRaises(TypeError, cons , N(s))
self.assertRaises(ZeroDivisionError, cons , E(s))
@@ -1573,7 +1576,8 @@ class TestVariousIteratorArgs(unittest.TestCase):
if isinstance(expected, bool):
self.assertEqual(actual, expected)
else:
- self.assertEqual(sorted(actual), sorted(expected))
+ with test_support.check_warnings():
+ self.assertEqual(sorted(actual), sorted(expected))
self.assertRaises(TypeError, meth, X(s))
self.assertRaises(TypeError, meth, N(s))
self.assertRaises(ZeroDivisionError, meth, E(s))
@@ -1587,7 +1591,8 @@ class TestVariousIteratorArgs(unittest.TestCase):
t = s.copy()
getattr(s, methname)(list(g(data)))
getattr(t, methname)(g(data))
- self.assertEqual(sorted(s), sorted(t))
+ with test_support.check_warnings():
+ self.assertEqual(sorted(s), sorted(t))
self.assertRaises(TypeError, getattr(set('january'), methname), X(data))
self.assertRaises(TypeError, getattr(set('january'), methname), N(data))