[3.13] gh-119555: catch SyntaxError from compile() in the InteractiveColoredConsole (GH-119557) (#119709)

This commit is contained in:
Miss Islington (bot) 2024-05-29 13:04:45 +02:00 committed by GitHub
parent 48c7776883
commit 40a024c983
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View file

@ -94,6 +94,14 @@ class TestSimpleInteract(unittest.TestCase):
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()