mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-26 14:11:16 +08:00
Move the iter_errors and normalizer methods to grammar.py.
This commit is contained in:
@@ -19,5 +19,5 @@ def test_on_itself(each_version):
|
||||
path = os.path.dirname(os.path.dirname(__file__)) + '/parso'
|
||||
for file in get_python_files(path):
|
||||
tree = grammar.parse(path=file)
|
||||
errors = list(tree._iter_errors(grammar))
|
||||
errors = list(grammar.iter_errors(tree))
|
||||
assert not errors
|
||||
|
||||
@@ -60,7 +60,7 @@ def test_normalizer_issue(normalizer_issue_case):
|
||||
|
||||
grammar = parso.load_grammar(version=normalizer_issue_case.python_version)
|
||||
module = grammar.parse(code)
|
||||
issues = module._get_normalizer_issues(grammar)
|
||||
issues = grammar._get_normalizer_issues(module)
|
||||
actual = sort(issues)
|
||||
|
||||
diff = '\n'.join(difflib.ndiff(desired, actual))
|
||||
|
||||
@@ -4,7 +4,7 @@ import parso
|
||||
def issues(code):
|
||||
grammar = parso.load_grammar()
|
||||
module = parso.parse(code)
|
||||
return module._get_normalizer_issues(grammar)
|
||||
return grammar._get_normalizer_issues(module)
|
||||
|
||||
|
||||
def test_eof_newline():
|
||||
|
||||
@@ -13,7 +13,7 @@ from .failing_examples import FAILING_EXAMPLES, indent, build_nested
|
||||
def _get_error_list(code, version=None):
|
||||
grammar = parso.load_grammar(version=version)
|
||||
tree = grammar.parse(code)
|
||||
return list(tree._iter_errors(grammar))
|
||||
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)]
|
||||
|
||||
Reference in New Issue
Block a user