• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python helpers.dfs_node_names函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.helpers.dfs_node_names函数的典型用法代码示例。如果您正苦于以下问题:Python dfs_node_names函数的具体用法?Python dfs_node_names怎么用?Python dfs_node_names使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dfs_node_names函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_methods_two_ctors_and_one_method

def test_methods_two_ctors_and_one_method():
    def fun():
        class B(object):
            def __init__(self):
                pass

            def method(self):
                "".lstrip()

        class A(object):
            def __init__(self):
                pass

            def method(self):
                "".rstrip()

        a = A() if None else B()
        a.method()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.A", "fun.B", "fun.method", "fun.method.rstrip",
            "fun.method", "fun.method.lstrip"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:27,代码来源:methods.py


示例2: test_methods_class_change

def test_methods_class_change():
    def fun():
        class B(object):
            def __init__(self):
                pass

            def method_b(self):
                pass

        class A(object):
            def __init__(self):
                pass

            def method_a(self):
                pass

        a = A()
        a.method_a()
        a = B()
        a.method_b()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.A", "fun.method_a", "fun.B", "fun.method_b"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:28,代码来源:methods.py


示例3: test_stmt_with_single

def test_stmt_with_single():
    class A(object):
        def __init__(self):
            pass

        def __enter__(self):
            b = ""
            b.find()
            return b
        def __exit__(self, t, v, tb):
            c = ""
            c.index()

    def fun():
        with A() as a:
            a.strip()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.A", "fun.__enter__", "fun.__enter__.find", "fun.strip",
            "fun.__exit__", "fun.__exit__.index"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:25,代码来源:stmt.py


示例4: test_decorators_class

def test_decorators_class():
    def fun():
        def decorator(cls):
            def decorating():
                return cls()
            return decorating

        @decorator
        class DecoratedClass(object):
            def __init__(self):
                pass

            def method(self):
                pass

        obj = DecoratedClass()
        obj.method()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.decorating", "fun.decorating.DecoratedClass",
            "fun.method"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:26,代码来源:decorators.py


示例5: test_decorators_chain

def test_decorators_chain():
    def kuku(function):
        @wraps(function)
        def decorating():
            return function()
        return decorating

    def decorator1(function):
        @wraps(function)
        def decorating1():
            return function()
        return decorating1

    def decorator2(function):
        @wraps(function)
        def decorating2():
            return function()
        return decorating2

    @decorator1
    @decorator2
    def decorated():
        pass

    builder = CallGraphBuilder()
    root = builder.build(decorated)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["decorating1", "decorating1.decorating2",
            "decorating1.decorating2.decorated"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:32,代码来源:decorators.py


示例6: test_assigns_attr_chain_call

def test_assigns_attr_chain_call():
    class A(object):
        def __init__(self):
            pass

        def f(self):
            return B()

    class B(object):
        def __init__(self):
            pass

        def method(self):
            pass

    def fun():
        A().f().method()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.A", "fun.f", "fun.f.B", "fun.method"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:25,代码来源:assings.py


示例7: test_stmt_with_tuple

def test_stmt_with_tuple():
    class A():
        def __init__(self):
            pass

        def __enter__(self):
            return 1, ""
        def __exit__(self, t, v, tb):
            pass

    def fun():
        with A() as (a, b):
            a.to_bytes(1, "big")
            a.strip()
            b.to_bytes(1, "big")
            b.strip()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.A", "fun.__enter__", "fun.to_bytes", "fun.strip",
            "fun.__exit__"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:25,代码来源:stmt.py


示例8: test_methods_two_ctors_and_method_and_ctor

def test_methods_two_ctors_and_method_and_ctor():
    class A(object):
        def __init__(self):
            pass

        def f(self):
            return ""

    class B(object):
        def __init__(self):
            pass

        def f(self):
            return C

    class C(object):
        def __init__(self):
            pass

        def f(self):
            return []

    def fun():
        a = A() if None else B()
        a.f().strip()
        a.f()().f().sort()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.A", "fun.B", "fun.f", "fun.f", "fun.strip", "fun.C",
            "fun.f", "fun.sort"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:35,代码来源:methods.py


示例9: test_classes_self_between_fun

def test_classes_self_between_fun():
    class A(object):
        def __init__(self):
            self.a = "str"

        def method(self):
            self.b = "str"

    def fun1():
        a = A()
        a.method()
        return a

    def fun():
        fun1().b.lstrip()
        b = A()
        b.a.rstrip()
        b.b.index()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.fun1", "fun.fun1.A", "fun.fun1.method", "fun.lstrip",
            "fun.A", "fun.rstrip"]

    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:28,代码来源:classes.py


示例10: test_classes_method_super

def test_classes_method_super():
    class A(object):
        def __init__(self):
            pass

        def method(self):
            "".rstrip()

    class B(A):
        def __init__(self):
            pass

        def method(self):
            "".lstrip()
            super().method()

    def fun():
        b = B()
        b.method()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.B", "fun.method", "fun.method.lstrip",
            "fun.method.__super__", "fun.method.method",
            "fun.method.method.rstrip"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:29,代码来源:classes.py


示例11: test_generators_from_two_obj

def test_generators_from_two_obj():
    class B(object):
        def __init__(self):
            pass

        def __next__(self):
            return ""

    class A(object):
        def __init__(self):
            pass

        def __iter__(self):
            return B()

    def fun():
        for entry in A():
            entry.strip()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree

    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.A", "fun.__iter__", "fun.__iter__.B", "fun.__next__", "fun.strip"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:27,代码来源:generators.py


示例12: test_methods_self_class

def test_methods_self_class():
    def fun():
        class A(object):
            def __init__(self):
                pass

            def method(self):
                pass

            @classmethod
            def class_method(cls):
                self.method()

            @staticmethod
            def static_method():
                self.method()

        a = A()
        a.class_method()
        a.static_method()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.A", "fun.class_method", "fun.static_method"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:28,代码来源:methods.py


示例13: test_functions_recur

def test_functions_recur():
    def recur():
        recur()

    builder = CallGraphBuilder()
    root = builder.build(recur)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["recur"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:11,代码来源:functions.py


示例14: test_stmt_raise_simple

def test_stmt_raise_simple():
    def fun():
        raise RuntimeError()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.RuntimeError"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:11,代码来源:stmt.py


示例15: test_ops_bin_add

def test_ops_bin_add():
    def fun():
        if "".strip() + "".find(): return

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.strip", "fun.find"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:11,代码来源:ops.py


示例16: test_stmt_lambda_returns

def test_stmt_lambda_returns():
    def fun():
        a = lambda x: x
        a("").strip()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.strip"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:12,代码来源:stmt.py


示例17: test_stmt_call_none

def test_stmt_call_none():
    def fun():
        a = None
        a()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:12,代码来源:stmt.py


示例18: test_stmt_for_dict

def test_stmt_for_dict():
    def fun():
        for key in {"k1": 1, "k2": 2}:
            key.strip()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.strip"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:12,代码来源:stmt.py


示例19: test_ops_cmp

def test_ops_cmp():
    def fun():
        if "".find() < "".strip(): return
        (1 < 2).to_bytes(1, "big")

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.find", "fun.strip", "fun.to_bytes"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:12,代码来源:ops.py


示例20: test_assigns_set_explode

def test_assigns_set_explode():
    def fun():
        a, b = {"", 2}
        a.rstrip()

    builder = CallGraphBuilder()
    root = builder.build(fun)
    from callgraph.indent_printer import dump_tree
    dump_tree(root, lambda x: x.children)

    path = ["fun", "fun.rstrip"]
    assert list(dfs_node_names(root)) == path
开发者ID:burlog,项目名称:py-static-callgraph,代码行数:12,代码来源:assings.py



注:本文中的tests.helpers.dfs_node_names函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python helpers.fake_commit函数代码示例发布时间:2022-05-27
下一篇:
Python helpers.captured函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap