summaryrefslogtreecommitdiff
path: root/Lib/test/mapping_tests.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-01-08 18:41:40 +0000
committerSenthil Kumaran <orsenthil@gmail.com>2010-01-08 18:41:40 +0000
commit3ddc435af6873c6304058d7bcbcb19ee4fba7781 (patch)
treec7a03cf0a8b856bae2ebebba55b09f775845c7ca /Lib/test/mapping_tests.py
parent3194d1454cbc11ec477d83fff3fc749972107d29 (diff)
downloadcpython-git-3ddc435af6873c6304058d7bcbcb19ee4fba7781.tar.gz
Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. Patch by flox
Diffstat (limited to 'Lib/test/mapping_tests.py')
-rw-r--r--Lib/test/mapping_tests.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/test/mapping_tests.py b/Lib/test/mapping_tests.py
index 7ec4bb1e13..d17c94887f 100644
--- a/Lib/test/mapping_tests.py
+++ b/Lib/test/mapping_tests.py
@@ -1,6 +1,7 @@
# tests common to dict and UserDict
import unittest
import UserDict
+import test_support
class BasicTestMappingProtocol(unittest.TestCase):
@@ -54,13 +55,18 @@ class BasicTestMappingProtocol(unittest.TestCase):
#len
self.assertEqual(len(p), 0)
self.assertEqual(len(d), len(self.reference))
- #has_key
+ #in
for k in self.reference:
- self.assertTrue(d.has_key(k))
self.assertTrue(k in d)
for k in self.other:
- self.assertFalse(d.has_key(k))
self.assertFalse(k in d)
+ #has_key
+ # Silence Py3k warning
+ with test_support.check_warnings():
+ for k in self.reference:
+ self.assertTrue(d.has_key(k))
+ for k in self.other:
+ self.assertFalse(d.has_key(k))
#cmp
self.assertEqual(cmp(p,p), 0)
self.assertEqual(cmp(d,d), 0)