当前位置: 首页>>代码示例>>Python>>正文


Python node.Node类代码示例

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


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

示例1: test_preferred_language_children

    def test_preferred_language_children(self, client):
        root = Node.root()
        sub = root.add("sub")

        root = Node.root(language="nl")
        child = root.children()[0]
        assert child.preferred_language == "nl"
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:7,代码来源:test_node.py

示例2: test_remove_single_root

    def test_remove_single_root(self, client, root):
        """ single, non-recursive removal """
        root.add("aaa")
        assert Node.get("/aaa")

        root.remove("aaa")
        assert not Node.get("/aaa")
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:7,代码来源:test_node.py

示例3: test_public_publication

 def test_public_publication(self, client):
     """ published with explicit publication date """
     now = timezone.now()
     Type1(node=Node.root(), state="published", expire=None, publication=now - timedelta(hours=1)).save()
     public = Node.objects.public()
     assert public.count() == 1
     assert public[0] == Node.root()
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:7,代码来源:test_node_manager.py

示例4: test_create_map

    def test_create_map(self, client):
        root = Node.root()
        r = root.add(langslugs=dict(fr="fr", en="en", nl="nl"))

        assert Node.get("/fr", language="fr") == \
               Node.get("/en", language="en") == \
               Node.get("/nl", language="nl") == r
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:7,代码来源:test_translations.py

示例5: test_public_publish

 def test_public_publish(self, client):
     """ published without explicit expire/publication """
     Type1(node=Node.root(), state="published",
           expire=None, publication=None).save()
     public = Node.objects.public()
     assert public.count() == 1
     assert public[0] == Node.root()
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:7,代码来源:test_node_manager.py

示例6: test_remove_ignore_similar

    def test_remove_ignore_similar(self, client):
        """ removing /aaa shouldn't affect /aaaa """
        root = Node.root()
        root.add("aaa")
        root.add("aaaa")

        root.remove("aaa")
        assert Node.get("/aaaa")
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:8,代码来源:test_node.py

示例7: test_remove_single_child

    def test_remove_single_child(self, client, root):
        """ single, non-recursive removal """
        child = root.add("aaa")
        child.add("bbb")

        assert Node.get("/aaa/bbb")

        child.remove("bbb")
        assert not Node.get("/aaa/bbb")
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:9,代码来源:test_node.py

示例8: test_remove_recursive

    def test_remove_recursive(self, client, root):
        """ recursive removal """
        child = root.add("aaa")
        child.add("b1")
        child.add("b2")
        assert Node.get("/aaa/b1")

        root.remove("aaa")
        assert not Node.get("/aaa/b1")
        assert not Node.get("/aaa/b2")
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:10,代码来源:test_node.py

示例9: test_node_equality

    def test_node_equality(self, client, root):
        sub = root.add("sub")
        sub_nl = Node.root(language="nl").children()[0]
        sub_en = Node.root(language="en").children()[0]

        assert sub_nl != sub_en
        assert sub_nl != sub

        sub.preferred_language = "nl"
        assert sub == sub_nl
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:10,代码来源:test_node.py

示例10: test_rename_recursive_similar

 def test_rename_recursive_similar(self, client):
     """ renaming /aaa should't affect /aaaa """
     aaa = Node.root().add("aaa")
     aaaa = Node.root().add("aaaa")
     aa = Node.root().add("aa")
     bbb = aaaa.add("bbb")
     bb = aa.add("bb")
     aaa.rename("ccc")
     assert Node.objects.get(pk=bbb.pk).path == "/aaaa/bbb"
     assert Node.objects.get(pk=bb.pk).path == "/aa/bb"
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:10,代码来源:test_node.py

示例11: test_add_different_slugs

    def test_add_different_slugs(self, client):
        translation.activate('en')
        root = Node.root()
        child = root.add("child")
        child.rename("kind", language="nl")
        grandchild = child.add("grandchild")

        assert grandchild.get_path(language="nl") == "/kind/grandchild"
        assert grandchild.get_path(language="en") == "/child/grandchild"
        assert Node.get("/child/grandchild", language="nl") is None
        assert Node.get("/kind/grandchild", language="en") is None
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:11,代码来源:test_translations.py

示例12: test_copy_node_position

    def test_copy_node_position(self, client):
        """ a node loses its original position when copied,
            it should always be moved to the bottom """
        root = Node.root()
        src = root.add("src", position=0)
        target = root.add("target")
        target_child = target.add("child", position=10)

        res, success, failed = target.paste(src, copy=True)

        assert Node.get("/target/src").position > target_child.position
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:11,代码来源:test_node.py

示例13: test_remove_recursive_child

    def test_remove_recursive_child(self, client, root):
        """ recursive removal """
        c1 = root.add("aaa")
        c2 = c1.add("bbb")
        c2.add("b1")
        c2.add("b2")
        assert Node.get("/aaa/bbb/b1")

        c1.remove("bbb")
        assert Node.get("/aaa")
        assert not Node.get("/aaa/bbb/b1")
        assert not Node.get("/aaa/bbb/b2")
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:12,代码来源:test_node.py

示例14: test_move_node

    def test_move_node(self, client, root):
        """ move a node and its descendants elsewhere """
        src = root.add("src")
        src_c = src.add("child")
        target = root.add("target")

        res, success, failed = target.paste(src)

        assert Node.get('/target/src') == src
        assert Node.get('/target/src/child') == src_c
        assert Node.get('/src') is None
        assert res.path == "/target/src"
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:12,代码来源:test_node.py

示例15: test_copy_node_inuse

    def test_copy_node_inuse(self, client):
        """ pasting a node to a node containing a child with the same name,
            e.g. pasting /foo to /target when there's already a /target/foo
        """
        root = Node.root()
        src = root.add("src")
        src_c = src.add("child")
        target = root.add("target")
        target_src = target.add("src")

        res, success, failed = target.paste(src)

        assert res.path != "/target/src"
        assert Node.get(res.path + "/child")
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:14,代码来源:test_node.py


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