Пример #1
0
 def test_simple(self):
     mod_ast = _transformer.get_fkt_ast(dummy)
     mod_source = _tosource.tosource(mod_ast)
     #         with open("dummy.py", "w") as f:
     #             f.write(mod_source)
     mod_ast2 = ast.parse(mod_source)
     assert compare_ast(mod_ast, mod_ast2.body[0])
Пример #2
0
    def test_simple(self):
        mod_ast = _transformer.get_fkt_ast(dummy)
        mod_source = _tosource.tosource(mod_ast)
#         with open("dummy.py", "w") as f:
#             f.write(mod_source)
        mod_ast2 = ast.parse(mod_source)
        assert compare_ast(mod_ast, mod_ast2.body[0])
Пример #3
0
 def test_get_fkt_ast_simple(self):
     fkt_ast = get_fkt_ast(dummy)
     assert fkt_ast is not None
     assert isinstance(fkt_ast, ast.FunctionDef)
     assert len(fkt_ast.body)==1
     assert isinstance(fkt_ast.body[0], ast.Return)