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.
........
This commit is contained in:
Ezio Melotti 2010-11-21 13:34:58 +00:00
parent 40a92f5c65
commit 2623a37852
184 changed files with 2328 additions and 2326 deletions

View file

@ -32,8 +32,8 @@ class ExceptionTests(unittest.TestCase):
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 @@ class ExceptionTests(unittest.TestCase):
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 @@ class ExceptionTests(unittest.TestCase):
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 @@ class ExceptionTests(unittest.TestCase):
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 @@ class ExceptionTests(unittest.TestCase):
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 @@ class ExceptionTests(unittest.TestCase):
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():