aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/parso/py2/tests/test_file_python_errors.py
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/python/parso/py2/tests/test_file_python_errors.py
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/python/parso/py2/tests/test_file_python_errors.py')
-rw-r--r--contrib/python/parso/py2/tests/test_file_python_errors.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/python/parso/py2/tests/test_file_python_errors.py b/contrib/python/parso/py2/tests/test_file_python_errors.py
new file mode 100644
index 00000000000..7083dfeb467
--- /dev/null
+++ b/contrib/python/parso/py2/tests/test_file_python_errors.py
@@ -0,0 +1,23 @@
+import os
+
+import parso
+
+
+def get_python_files(path):
+ for dir_path, dir_names, file_names in os.walk(path):
+ for file_name in file_names:
+ if file_name.endswith('.py'):
+ yield os.path.join(dir_path, file_name)
+
+
+def test_on_itself(each_version):
+ """
+ There are obviously no syntax erros in the Python code of parso. However
+ parso should output the same for all versions.
+ """
+ grammar = parso.load_grammar(version=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(grammar.iter_errors(tree))
+ assert not errors