mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-08 13:45:01 +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'{\"}'",
|
||||||
"f'{\"}'",
|
"f'{\"}'",
|
||||||
# Now nested parsing
|
# Now nested parsing
|
||||||
"f'{1+}'",
|
|
||||||
"f'{continue}'",
|
"f'{continue}'",
|
||||||
"f'{1;1}'",
|
"f'{1;1}'",
|
||||||
"f'{a=3}'",
|
"f'{a=3}'",
|
||||||
|
|||||||
@@ -246,3 +246,17 @@ def test_too_many_levels_of_indentation():
|
|||||||
)
|
)
|
||||||
def test_valid_fstrings(code):
|
def test_valid_fstrings(code):
|
||||||
assert not _get_error_list(code, version='3.6')
|
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