Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line
#9424: Replace deprecated assert* methods in the Python test suite.
........
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 3ee0856..a19c82d 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -32,8 +32,8 @@
raise exc("spam")
except exc, err:
buf2 = str(err)
- self.assertEquals(buf1, buf2)
- self.assertEquals(exc.__name__, excname)
+ self.assertEqual(buf1, buf2)
+ self.assertEqual(exc.__name__, excname)
def testRaising(self):
self.raise_catch(AttributeError, "AttributeError")
@@ -163,7 +163,7 @@
except TypeError, err:
exc, err, tb = sys.exc_info()
co = tb.tb_frame.f_code
- self.assertEquals(co.co_name, "test_capi1")
+ self.assertEqual(co.co_name, "test_capi1")
self.assertTrue(co.co_filename.endswith('test_exceptions'+os.extsep+'py'))
else:
self.fail("Expected exception")
@@ -175,10 +175,10 @@
except RuntimeError, err:
exc, err, tb = sys.exc_info()
co = tb.tb_frame.f_code
- self.assertEquals(co.co_name, "__init__")
+ self.assertEqual(co.co_name, "__init__")
self.assertTrue(co.co_filename.endswith('test_exceptions'+os.extsep+'py'))
co2 = tb.tb_frame.f_back.f_code
- self.assertEquals(co2.co_name, "test_capi2")
+ self.assertEqual(co2.co_name, "test_capi2")
else:
self.fail("Expected exception")
@@ -284,14 +284,14 @@
if type(e) is not exc:
raise
# Verify module name
- self.assertEquals(type(e).__module__, 'exceptions')
+ self.assertEqual(type(e).__module__, 'exceptions')
# Verify no ref leaks in Exc_str()
s = str(e)
for checkArgName in expected:
- self.assertEquals(repr(getattr(e, checkArgName)),
- repr(expected[checkArgName]),
- 'exception "%s", attribute "%s"' %
- (repr(e), checkArgName))
+ self.assertEqual(repr(getattr(e, checkArgName)),
+ repr(expected[checkArgName]),
+ 'exception "%s", attribute "%s"' %
+ (repr(e), checkArgName))
# test for pickling support
for p in pickle, cPickle:
@@ -300,9 +300,9 @@
for checkArgName in expected:
got = repr(getattr(new, checkArgName))
want = repr(expected[checkArgName])
- self.assertEquals(got, want,
- 'pickled "%r", attribute "%s"' %
- (e, checkArgName))
+ self.assertEqual(got, want,
+ 'pickled "%r", attribute "%s"' %
+ (e, checkArgName))
def testDeprecatedMessageAttribute(self):
@@ -359,7 +359,7 @@
self.fancy_arg = fancy_arg
x = DerivedException(fancy_arg=42)
- self.assertEquals(x.fancy_arg, 42)
+ self.assertEqual(x.fancy_arg, 42)
def testInfiniteRecursion(self):
def f():