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


Python treedict.getTree函数代码示例

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


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

示例1: testRecall_copying

    def testRecall_copying(self):
        p1 = getTree('rt_r01')
        p1.makeBranch('rt_b01')

        p1c = p1.rt_b01.copy()

        p2 = getTree('rt_b01')
        
        self.assert_(p1c is not p2)
开发者ID:real666maverick,项目名称:treedict,代码行数:9,代码来源:test_centralsystem.py

示例2: testRecall_01

    def testRecall_01(self):
        self.assert_(not treedict.treeExists('testtree'))

        p = treedict.getTree('testtree')

        self.assert_(treedict.treeExists('testtree'))

        p2 = treedict.getTree('testtree')
        
        self.assert_(p is p2)
开发者ID:real666maverick,项目名称:treedict,代码行数:10,代码来源:test_centralsystem.py

示例3: testRecall_01

    def testRecall_01(self):
        name = 'testtree-%d' % common._inheritance_level

        self.assert_(not treedict.treeExists(name))

        p = treedict.getTree(name)

        self.assert_(treedict.treeExists(name))

        p2 = treedict.getTree(name)
        
        self.assert_(p is p2)
开发者ID:hoytak,项目名称:treedict,代码行数:12,代码来源:test_centralsystem.py

示例4: testConstraint_21_global__branches_track_original_deep

    def testConstraint_21_global__branches_track_original_deep(self):
        n = 100
        tn = unique_name()
        bnl = [unique_name() for i in range(n)]
        p = getTree(tn)

        fullbn = '.'.join(bnl)

        p.makeBranch(fullbn)

        bl = [None]*n

        for i, bn in enumerate(bnl):
            bl[i] = (p if i == 0 else bl[i-1])[bn]

        treedict.addGlobalConstraint(fullbn + '.x', [1], "not 1")

        for i, b in enumerate(bnl[:-1]):

            def f():
                bl[i]['.'.join(bnl[i+1:]) + '.x'] = 2

            self.assertRaises(ValueError, f)

        for i, b in enumerate(bnl[:-1]):
            bl[i]['.'.join(bnl[i+1:]) + '.x'] = 1
开发者ID:real666maverick,项目名称:treedict,代码行数:26,代码来源:test_constraints.py

示例5: testConstraint_06_afterwards_2

    def testConstraint_06_afterwards_2(self):
        tn = unique_name()
        bn = unique_name()

        p = getTree(tn)
        p[bn] = "bork"  # passes
        
        treedict.addConstraint(unique_name(), bn,["bork", "bork1"])
开发者ID:real666maverick,项目名称:treedict,代码行数:8,代码来源:test_constraints.py

示例6: testConstraint_17_global_constraint_not_added_on_failure

    def testConstraint_17_global_constraint_not_added_on_failure(self):
        tn1 = unique_name()
        tn2 = unique_name()
        bn = unique_name()
        
        p1 = getTree(tn1)
        p1[bn] = 2

        p2 = getTree(tn2)

        def f():
            treedict.addGlobalConstraint(bn, [1], "not 1")
            
        self.assertRaises(ValueError, f)

        # Should be fine still, as the constraint should be backed out
        p2[bn] = 2
开发者ID:real666maverick,项目名称:treedict,代码行数:17,代码来源:test_constraints.py

示例7: testConstraint_07_afterwards_global_2

    def testConstraint_07_afterwards_global_2(self):
        tn = unique_name()
        bn = unique_name()

        p = getTree(tn)
        p[bn] = "bork"
        
        treedict.addGlobalConstraint(bn, ["bork", "bork1"])
开发者ID:real666maverick,项目名称:treedict,代码行数:8,代码来源:test_constraints.py

示例8: testConstraint_09_branches_in_tree_names_02

    def testConstraint_09_branches_in_tree_names_02(self):
        tn = unique_name()

        p = getTree(tn)

        treedict.addConstraint(tn + '.b', 'a', [1], "not 1")

        # shouldn't throw
        p.b.a = 2
开发者ID:real666maverick,项目名称:treedict,代码行数:9,代码来源:test_constraints.py

示例9: testConstraint_09_branches_in_tree_names_03_control

    def testConstraint_09_branches_in_tree_names_03_control(self):
        tn = unique_name()
        tnb = tn + '.b'
        p = getTree(tnb)

        treedict.addConstraint(tnb, 'a', [1], "not 1")

        # shouldn't throw
        p.a = 1
开发者ID:real666maverick,项目名称:treedict,代码行数:9,代码来源:test_constraints.py

示例10: testConstraint_11_copying_02_aferwards

    def testConstraint_11_copying_02_aferwards(self):
        tn, bn = unique_name(), unique_name()

        p1 = getTree(tn)
        p1c = p1.makeBranch(bn).copy()
        p2 = getTree(bn)
        
        
        # Should work fine; not part of p2's family
        p1c.a = 2
        self.assert_(p1c.branchName() == bn)
        
        # Should cause throw, cause it's part of p2's family
        p2.a = 2
        
        def f(): treedict.addConstraint(bn, 'a', [1], "not 1")

        self.assertRaises(ValueError, f)
开发者ID:real666maverick,项目名称:treedict,代码行数:18,代码来源:test_constraints.py

示例11: testConstraint_25_Links_01

    def testConstraint_25_Links_01(self):
        tn = unique_name()
        p = treedict.getTree(tn)
        treedict.addConstraint(tn, 'a.b.link.v', [1], "not 1")

        p.d.v = 1
        p.a.b.link = p.d

        self.assert_(p.a.b.link.v == 1)
开发者ID:real666maverick,项目名称:treedict,代码行数:9,代码来源:test_constraints.py

示例12: testConstraint_07_afterwards_global_1_copy_control

    def testConstraint_07_afterwards_global_1_copy_control(self):
        tn = unique_name()
        bn = unique_name()

        p = getTree(tn)
        b = p.copy()
        b[bn] = 1
        
        # Should be fine
        treedict.addGlobalConstraint(bn, [1], "not 1")
开发者ID:real666maverick,项目名称:treedict,代码行数:10,代码来源:test_constraints.py

示例13: testConstraint_08_global_branch_copy_afterwards_1_control

    def testConstraint_08_global_branch_copy_afterwards_1_control(self):
        bn = unique_name()

        p = getTree(unique_name())
        p.makeBranch(bn).makeBranch('a')

        q = p[bn].copy()
        q.a.b = "bork"  # should be bad

        treedict.addGlobalConstraint(bn + '.a.b', ["bork"])
开发者ID:real666maverick,项目名称:treedict,代码行数:10,代码来源:test_constraints.py

示例14: testConstraint_06_afterwards_2_copy

    def testConstraint_06_afterwards_2_copy(self):
        tn = unique_name()
        bn = unique_name()

        p = getTree(tn)
        p[bn] = "bork"  # passes
        q = p.copy(deep = True)
        q[bn] = "bork1"  # passes

        treedict.addConstraint(tn, bn, ["bork", "bork1"])
开发者ID:real666maverick,项目名称:treedict,代码行数:10,代码来源:test_constraints.py

示例15: testSetGet06

    def testSetGet06(self):

        # regression test
        p = getTree('upt_08_bcg1_')
        p.a18462.a1732643.x = 1
        q = p.a18462.copy()
        q.a1732643.a1232 = "borkbork"  # should be bad

        self.assert_(p.a18462.a1732643.x == 1)
        self.assert_(q.a1732643.a1232 == "borkbork")
        self.assert_(q.a1732643.x == 1)
开发者ID:aurora1625,项目名称:treedict,代码行数:11,代码来源:test_setting.py


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