mirror of
https://github.com/python/cpython.git
synced 2025-10-19 16:03:42 +00:00
gh-119555: catch SyntaxError from compile() in the InteractiveColoredConsole (#119557)
This commit is contained in:
parent
c0faade891
commit
86d1a1aa88
3 changed files with 11 additions and 1 deletions
|
@ -94,6 +94,14 @@ def test_runsource_shows_syntax_error_for_failed_compilation(self):
|
|||
with patch.object(console, "showsyntaxerror") as mock_showsyntaxerror:
|
||||
console.runsource(source)
|
||||
mock_showsyntaxerror.assert_called_once()
|
||||
source = dedent("""\
|
||||
match 1:
|
||||
case {0: _, 0j: _}:
|
||||
pass
|
||||
""")
|
||||
with patch.object(console, "showsyntaxerror") as mock_showsyntaxerror:
|
||||
console.runsource(source)
|
||||
mock_showsyntaxerror.assert_called_once()
|
||||
|
||||
def test_no_active_future(self):
|
||||
console = InteractiveColoredConsole()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue