Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. Patch by flox
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index ec818d1..5bac62a 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -2,7 +2,7 @@
Test cases for pyclbr.py
Nick Mathewson
'''
-from test.test_support import run_unittest
+from test.test_support import run_unittest, import_module
import sys
from types import ClassType, FunctionType, MethodType, BuiltinFunctionType
import pyclbr
@@ -13,6 +13,8 @@
# This next line triggers an error on old versions of pyclbr.
+# Silence Py3k warning
+import_module('commands', deprecated=True)
from commands import getstatus
# Here we test the python class browser code.
@@ -40,11 +42,11 @@
def assertHaskey(self, obj, key, ignore):
- ''' succeed iff obj.has_key(key) or key in ignore. '''
+ ''' succeed iff key in obj or key in ignore. '''
if key in ignore: return
- if not obj.has_key(key):
- print >>sys.stderr, "***",key
- self.assertTrue(obj.has_key(key))
+ if key not in obj:
+ print >>sys.stderr, "***", key
+ self.assertTrue(key in obj)
def assertEqualsOrIgnored(self, a, b, ignore):
''' succeed iff a == b or a in ignore or b in ignore '''
@@ -149,7 +151,9 @@
def test_easy(self):
self.checkModule('pyclbr')
self.checkModule('doctest', ignore=("DocTestCase",))
- self.checkModule('rfc822')
+ # Silence Py3k warning
+ rfc822 = import_module('rfc822', deprecated=True)
+ self.checkModule('rfc822', rfc822)
self.checkModule('difflib')
def test_decorators(self):