def test_no_arg_transformer(self):
        nti = AstTransformerItem(IdentityTransform)

        nodes_visited = []
        tree = ast.parse(inspect.getsource(sample_code))

        new_tree = nti.copy_and_transform(tree)

        assert_not_equal(tree, new_tree)
示例#2
0
    def test_no_arg_transformer(self):
        nti = AstTransformerItem(IdentityTransform)

        nodes_visited = []
        tree = ast.parse(inspect.getsource(sample_code))

        new_tree = nti.copy_and_transform(tree)

        assert_not_equal(tree, new_tree)
示例#3
0
    def test_basic_load(self):
        trees = AstTreeManager()

        assert_equal(trees.count(), 0)

        test_ast = trees.new_item_from_source(inspect.getsource(sample_code))

        assert_equal(trees.count(), 1)
        assert_is_not_none(test_ast)

        ti = AstTransformerItem(NoisyIdentityTransform)
        trees.create_transformed_child(test_ast, ast_transform_item=ti)

        assert_equal(trees.count(), 2)
    def test_basics(self):
        nti = AstTransformerItem(IdentityTransform)

        assert_equal(nti.name(), "IdentityTransform")
        assert_equal(nti.package(),
                     "ast_tool_box.transformers.identity_transform")
示例#5
0
    def test_basics(self):
        nti = AstTransformerItem(IdentityTransform)

        assert_equal(nti.name(), "IdentityTransform")
        assert_equal(nti.package(), "ast_tool_box.transformers.identity_transform")