aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/parso/py2/tests/test_file_python_errors.py
diff options
context:
space:
mode:
authornkozlovskiy <nmk@ydb.tech>2023-09-29 12:24:06 +0300
committernkozlovskiy <nmk@ydb.tech>2023-09-29 12:41:34 +0300
commite0e3e1717e3d33762ce61950504f9637a6e669ed (patch)
treebca3ff6939b10ed60c3d5c12439963a1146b9711 /contrib/python/parso/py2/tests/test_file_python_errors.py
parent38f2c5852db84c7b4d83adfcb009eb61541d1ccd (diff)
downloadydb-e0e3e1717e3d33762ce61950504f9637a6e669ed.tar.gz
add ydb deps
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