mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-15 17:07:13 +08:00
Move the error node checking to a rule.
This commit is contained in:
@@ -137,6 +137,7 @@ FAILING_EXAMPLES = [
|
||||
'def x():\n 1\n 2',
|
||||
'def x():\n 1\n 2',
|
||||
'if 1:\nfoo',
|
||||
'if 1: blubb\nif 1:\npass\nTrue and False',
|
||||
]
|
||||
|
||||
GLOBAL_NONLOCAL_ERROR = [
|
||||
|
||||
@@ -21,6 +21,7 @@ def _get_error_list(code, version=None):
|
||||
tree = grammar.parse(code)
|
||||
return list(grammar.iter_errors(tree))
|
||||
|
||||
|
||||
def assert_comparison(code, error_code, positions):
|
||||
errors = [(error.start_pos, error.code) for error in _get_error_list(code)]
|
||||
assert [(pos, error_code) for pos in positions] == errors
|
||||
|
||||
Reference in New Issue
Block a user