Skip to content

Commit

Permalink
Only validate ASTs against the specific Python version we target.
Browse files Browse the repository at this point in the history
whitequark committed Jan 26, 2017
1 parent 23d5696 commit 4d861af
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pythonparser/test/test_parser.py
Original file line number Diff line number Diff line change
@@ -138,7 +138,10 @@ def assertParsesGen(self, expected_flat_ast, code,
flat_ast)
self.match_loc(ast, loc_matcher, ast_slicer)

if version == sys.version_info[0:2] and validate_if():
compatible_pyast_version = \
(sys.version_info[0:2] == (2, 7) or
sys.version_info[0:2] == (3, 4))
if compatible_pyast_version and version == sys.version_info[0:2] and validate_if():
python_ast = pyast.parse(code.replace("·", "\n") + "\n")
flat_python_ast = self.flatten_python_ast(python_ast)
self.assertEqual({"ty": "Module", "body": expected_flat_ast},

0 comments on commit 4d861af

Please sign in to comment.