mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Fix repl not coloring 'lazy' after 'from'
This commit is contained in:
parent
e6633ffeb8
commit
510c20081d
2 changed files with 2 additions and 1 deletions
|
|
@ -276,7 +276,7 @@ def is_soft_keyword_used(*tokens: TI | None) -> bool:
|
||||||
TI(T.NAME, string=s)
|
TI(T.NAME, string=s)
|
||||||
):
|
):
|
||||||
return not keyword.iskeyword(s)
|
return not keyword.iskeyword(s)
|
||||||
case (None | TI(T.NEWLINE) | TI(T.INDENT) | TI(T.DEDENT), TI(string="lazy"), TI(string="import")):
|
case (None | TI(T.NEWLINE) | TI(T.INDENT) | TI(T.DEDENT), TI(string="lazy"), TI(string="import") | TI(string="from")):
|
||||||
return True
|
return True
|
||||||
case _:
|
case _:
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ def test_gen_colors_keyword_highlighting(self):
|
||||||
("list", [("list", "builtin")]),
|
("list", [("list", "builtin")]),
|
||||||
(" \n dict", [("dict", "builtin")]),
|
(" \n dict", [("dict", "builtin")]),
|
||||||
(" lazy import", [("lazy", "soft_keyword"), ("import", "keyword")]),
|
(" lazy import", [("lazy", "soft_keyword"), ("import", "keyword")]),
|
||||||
|
("lazy from cool_people import pablo", [('lazy', 'soft_keyword'), ('from', 'keyword'), ('import', 'keyword')])
|
||||||
]
|
]
|
||||||
for code, expected_highlights in cases:
|
for code, expected_highlights in cases:
|
||||||
with self.subTest(code=code):
|
with self.subTest(code=code):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue