mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-07 05:14:29 +08:00
Fix f-string escapes, fixes #48
The tokenizer was not detecting backslash escapes for f-string endings properly
This commit is contained in:
@@ -258,6 +258,10 @@ def test_too_many_levels_of_indentation():
|
||||
@pytest.mark.parametrize(
|
||||
'code', [
|
||||
"f'{*args,}'",
|
||||
r'f"\""',
|
||||
r'f"\\\""',
|
||||
r'fr"\""',
|
||||
r'fr"\\\""',
|
||||
]
|
||||
)
|
||||
def test_valid_fstrings(code):
|
||||
@@ -267,6 +271,8 @@ def test_valid_fstrings(code):
|
||||
@pytest.mark.parametrize(
|
||||
('code', 'message'), [
|
||||
("f'{1+}'", ('invalid syntax')),
|
||||
(r'f"\"', ('invalid syntax')),
|
||||
(r'fr"\"', ('invalid syntax')),
|
||||
]
|
||||
)
|
||||
def test_invalid_fstrings(code, message):
|
||||
|
||||
Reference in New Issue
Block a user