#7092: silence py3k warnings for deprecated modules
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index 8d22fc2..fda76d4 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
@@ -11,8 +11,10 @@
StaticMethodType = type(staticmethod(lambda: None))
ClassMethodType = type(classmethod(lambda c: None))
-# This next line triggers an error on old versions of pyclbr.
+# Silence Py3k warning
+import_module('commands', deprecated=True)
+# This next line triggers an error on old versions of pyclbr.
from commands import getstatus
# Here we test the python class browser code.
@@ -40,16 +42,16 @@
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.assertIn(key, obj)
def assertEqualsOrIgnored(self, a, b, ignore):
''' succeed iff a == b or a in ignore or b in ignore '''
if a not in ignore and b not in ignore:
- self.assertEquals(a, b)
+ self.assertEqual(a, b)
def checkModule(self, moduleName, module=None, ignore=()):
''' succeed iff pyclbr.readmodule_ex(modulename) corresponds
@@ -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):