test_unparse.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:typed-astunparse 作者: mbdevpl 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号