diff options
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r-- | Lib/test/test_traceback.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index b2c7262..f9e4458 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -171,11 +171,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')) @@ -219,7 +219,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.assertTrue('1/0 # Marker' in lines[2]) @@ -234,8 +234,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.assertTrue('inner_raise() # Marker' in blocks[2]) @@ -248,8 +248,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.assertTrue('inner_raise() # Marker' in blocks[2]) @@ -268,10 +268,10 @@ 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.assert_('inner_raise() # Marker' in blocks[2]) + self.assertIn('inner_raise() # Marker', blocks[2]) def test_cause_recursive(self): def inner_raise(): @@ -286,8 +286,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.assertTrue('raise KeyError from e' in blocks[0]) self.assertTrue('1/0' not in blocks[0]) @@ -320,7 +320,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 |