def test_untyped_files(self):
"""Unparse Python stdlib correctly even if parsed using built-in ast package."""
for path in PATHS:
with open(path, 'r', encoding='utf-8') as py_file:
original_code = py_file.read()
tree = ast.parse(source=original_code, filename=path)
code = typed_astunparse.unparse(tree)
roundtrip_tree = ast.parse(source=code)
tree_dump = ast.dump(tree, include_attributes=False)
roundtrip_tree_dump = ast.dump(roundtrip_tree, include_attributes=False)
self.assertEqual(tree_dump, roundtrip_tree_dump, msg=path)
评论列表
文章目录