mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-07 21:34:32 +08:00
Small test refactoring, because not all fstrings errors from parso match the CPython equivalents.
This commit is contained in:
@@ -152,7 +152,6 @@ FAILING_EXAMPLES = [
|
||||
"f'{\"}'",
|
||||
"f'{\"}'",
|
||||
# Now nested parsing
|
||||
"f'{1+}'",
|
||||
"f'{continue}'",
|
||||
"f'{1;1}'",
|
||||
"f'{a=3}'",
|
||||
|
||||
@@ -246,3 +246,17 @@ def test_too_many_levels_of_indentation():
|
||||
)
|
||||
def test_valid_fstrings(code):
|
||||
assert not _get_error_list(code, version='3.6')
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('code', 'message'), [
|
||||
("f'{1+}'", ('invalid syntax')),
|
||||
]
|
||||
)
|
||||
def test_invalid_fstrings(code, message):
|
||||
"""
|
||||
Some fstring errors are handled differntly in 3.6 and other versions.
|
||||
Therefore check specifically for these errors here.
|
||||
"""
|
||||
error, = _get_error_list(code, version='3.6')
|
||||
assert message in error.message
|
||||
|
||||
Reference in New Issue
Block a user