Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Lib/test/test_contextlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,17 @@ def raise_exc(exc):
self.assertIsInstance(exc, ValueError)
ve_frames = traceback.extract_tb(exc.__traceback__)
expected = \
[('test_exit_exception_traceback', 'with self.exit_stack() as stack:')] + \
[(
'test_exit_exception_traceback',
'with self.exit_stack() as stack:\n'
' stack.callback(raise_exc, ValueError)\n'
' 1/0'
)] + \
self.callback_error_internal_frames + \
[('_exit_wrapper', 'callback(*args, **kwds)'),
('raise_exc', 'raise exc')]

# breakpoint()
self.assertEqual(
[(f.name, f.line) for f in ve_frames], expected)

Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2918,6 +2918,9 @@ def test_unicode(): """
Traceback (most recent call last):
File ...
exec(compile(example.source, filename, "single",
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
compileflags, True), test.globs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<doctest foo-bär@baz[0]>", line 1, in <module>
raise Exception('clé')
Exception: clé
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2045,14 +2045,15 @@ def test_multiline_not_highlighted(self):
""",
[
' 1 < 2 and',
' 3 > 4',
'AssertionError',
],
),
]
for source, expected in cases:
with self.subTest(source):
result = self.write_source(source)
self.assertEqual(result[-2:], expected)
self.assertEqual(result[-len(expected):], expected)


class SyntaxErrorTests(unittest.TestCase):
Expand Down
Loading