summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_userdict.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-01-08 18:41:40 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-01-08 18:41:40 (GMT)
commit3ddc435af6873c6304058d7bcbcb19ee4fba7781 (patch)
treec7a03cf0a8b856bae2ebebba55b09f775845c7ca /Lib/test/test_userdict.py
parent3194d1454cbc11ec477d83fff3fc749972107d29 (diff)
downloadcpython-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_userdict.py')
-rw-r--r--Lib/test/test_userdict.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index c86a773..cf631ff 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -45,7 +45,9 @@ class UserDictTest(mapping_tests.TestHashMappingProtocol):
# Test __repr__
self.assertEqual(str(u0), str(d0))
self.assertEqual(repr(u1), repr(d1))
- self.assertEqual(`u2`, `d2`)
+ # Silence Py3k warning
+ with test_support.check_warnings():
+ self.assertEqual(eval('`u2`'), eval('`d2`'))
# Test __cmp__ and __len__
all = [d0, d1, d2, u, u0, u1, u2, uu, uu0, uu1, uu2]
@@ -95,12 +97,14 @@ class UserDictTest(mapping_tests.TestHashMappingProtocol):
# Test has_key and "in".
for i in u2.keys():
- self.assertTrue(u2.has_key(i))
self.assertTrue(i in u2)
- self.assertEqual(u1.has_key(i), d1.has_key(i))
self.assertEqual(i in u1, i in d1)
- self.assertEqual(u0.has_key(i), d0.has_key(i))
self.assertEqual(i in u0, i in d0)
+ # Silence Py3k warning
+ with test_support.check_warnings():
+ self.assertTrue(u2.has_key(i))
+ self.assertEqual(u1.has_key(i), d1.has_key(i))
+ self.assertEqual(u0.has_key(i), d0.has_key(i))
# Test update
t = UserDict.UserDict()