mirror of
https://github.com/python/cpython.git
synced 2025-12-22 08:29:12 +00:00
gh-136801: Fix PyREPL syntax highlightning on match cases after multi-line case (GH-136804)
This commit is contained in:
parent
6a1c93af80
commit
3a64844533
3 changed files with 10 additions and 7 deletions
|
|
@ -375,7 +375,8 @@ class TestReaderInColor(ScreenEqualMixin, TestCase):
|
|||
)
|
||||
match case:
|
||||
case "emscripten": print("on the web")
|
||||
case "ios" | "android": print("on the phone")
|
||||
case "ios" | "android":
|
||||
print("on the phone")
|
||||
case _: print('arms around', match.group(1))
|
||||
"""
|
||||
)
|
||||
|
|
@ -393,7 +394,8 @@ class TestReaderInColor(ScreenEqualMixin, TestCase):
|
|||
{o}){z}
|
||||
{K}match{z} case{o}:{z}
|
||||
{K}case{z} {s}"emscripten"{z}{o}:{z} {b}print{z}{o}({z}{s}"on the web"{z}{o}){z}
|
||||
{K}case{z} {s}"ios"{z} {o}|{z} {s}"android"{z}{o}:{z} {b}print{z}{o}({z}{s}"on the phone"{z}{o}){z}
|
||||
{K}case{z} {s}"ios"{z} {o}|{z} {s}"android"{z}{o}:{z}
|
||||
{b}print{z}{o}({z}{s}"on the phone"{z}{o}){z}
|
||||
{K}case{z} {K}_{z}{o}:{z} {b}print{z}{o}({z}{s}'arms around'{z}{o},{z} match{o}.{z}group{o}({z}{n}1{z}{o}){z}{o}){z}
|
||||
"""
|
||||
)
|
||||
|
|
@ -402,14 +404,14 @@ class TestReaderInColor(ScreenEqualMixin, TestCase):
|
|||
reader, _ = handle_all_events(events)
|
||||
self.assert_screen_equal(reader, code, clean=True)
|
||||
self.assert_screen_equal(reader, expected_sync)
|
||||
self.assertEqual(reader.pos, 2**7 + 2**8)
|
||||
self.assertEqual(reader.cxy, (0, 14))
|
||||
self.assertEqual(reader.pos, 396)
|
||||
self.assertEqual(reader.cxy, (0, 15))
|
||||
|
||||
async_msg = "{k}async{z} ".format(**colors)
|
||||
expected_async = expected.format(a=async_msg, **colors)
|
||||
more_events = itertools.chain(
|
||||
code_to_events(code),
|
||||
[Event(evt="key", data="up", raw=bytearray(b"\x1bOA"))] * 13,
|
||||
[Event(evt="key", data="up", raw=bytearray(b"\x1bOA"))] * 14,
|
||||
code_to_events("async "),
|
||||
)
|
||||
reader, _ = handle_all_events(more_events)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue