summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_traceback.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2010-11-20 19:04:17 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2010-11-20 19:04:17 (GMT)
commitb3aedd48621ed9d33b5f42f946b256bce4a50673 (patch)
tree2297c8ebce1b09621e1d98096c1603896d9a0f0c /Lib/test/test_traceback.py
parentb8bc439b2093add9b313bcca2cc507a2d0e87764 (diff)
downloadcpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.zip
cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.gz
cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.bz2
#9424: Replace deprecated assert* methods in the Python test suite.
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r--Lib/test/test_traceback.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 7567849..4752d37 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -164,11 +164,11 @@ class TracebackFormatTests(unittest.TestCase):
raise Error("unable to create test traceback string")
# Make sure that Python and the traceback module format the same thing
- self.assertEquals(traceback_fmt, python_fmt)
+ self.assertEqual(traceback_fmt, python_fmt)
# Make sure that the traceback is properly indented.
tb_lines = python_fmt.splitlines()
- self.assertEquals(len(tb_lines), 3)
+ self.assertEqual(len(tb_lines), 3)
banner, location, source_line = tb_lines
self.assertTrue(banner.startswith('Traceback'))
self.assertTrue(location.startswith(' File'))
@@ -212,7 +212,7 @@ class BaseExceptionReportingTests:
except ZeroDivisionError as _:
e = _
lines = self.get_report(e).splitlines()
- self.assertEquals(len(lines), 4)
+ self.assertEqual(len(lines), 4)
self.assertTrue(lines[0].startswith('Traceback'))
self.assertTrue(lines[1].startswith(' File'))
self.assertIn('1/0 # Marker', lines[2])
@@ -227,8 +227,8 @@ class BaseExceptionReportingTests:
def outer_raise():
inner_raise() # Marker
blocks = boundaries.split(self.get_report(outer_raise))
- self.assertEquals(len(blocks), 3)
- self.assertEquals(blocks[1], cause_message)
+ self.assertEqual(len(blocks), 3)
+ self.assertEqual(blocks[1], cause_message)
self.check_zero_div(blocks[0])
self.assertIn('inner_raise() # Marker', blocks[2])
@@ -241,8 +241,8 @@ class BaseExceptionReportingTests:
def outer_raise():
inner_raise() # Marker
blocks = boundaries.split(self.get_report(outer_raise))
- self.assertEquals(len(blocks), 3)
- self.assertEquals(blocks[1], context_message)
+ self.assertEqual(len(blocks), 3)
+ self.assertEqual(blocks[1], context_message)
self.check_zero_div(blocks[0])
self.assertIn('inner_raise() # Marker', blocks[2])
@@ -261,8 +261,8 @@ class BaseExceptionReportingTests:
def outer_raise():
inner_raise() # Marker
blocks = boundaries.split(self.get_report(outer_raise))
- self.assertEquals(len(blocks), 3)
- self.assertEquals(blocks[1], cause_message)
+ self.assertEqual(len(blocks), 3)
+ self.assertEqual(blocks[1], cause_message)
self.check_zero_div(blocks[0])
self.assertIn('inner_raise() # Marker', blocks[2])
@@ -279,8 +279,8 @@ class BaseExceptionReportingTests:
def outer_raise():
inner_raise() # Marker
blocks = boundaries.split(self.get_report(outer_raise))
- self.assertEquals(len(blocks), 3)
- self.assertEquals(blocks[1], cause_message)
+ self.assertEqual(len(blocks), 3)
+ self.assertEqual(blocks[1], cause_message)
# The first block is the KeyError raised from the ZeroDivisionError
self.assertIn('raise KeyError from e', blocks[0])
self.assertNotIn('1/0', blocks[0])
@@ -313,7 +313,7 @@ class PyExcReportingTests(BaseExceptionReportingTests, unittest.TestCase):
traceback.format_exception(type(e), e, e.__traceback__))
with captured_output("stderr") as sio:
traceback.print_exception(type(e), e, e.__traceback__)
- self.assertEquals(sio.getvalue(), s)
+ self.assertEqual(sio.getvalue(), s)
return s