本文整理汇总了Python中treedict.TreeDict.b方法的典型用法代码示例。如果您正苦于以下问题:Python TreeDict.b方法的具体用法?Python TreeDict.b怎么用?Python TreeDict.b使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类treedict.TreeDict
的用法示例。
在下文中一共展示了TreeDict.b方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testUpdate_WithFreezing_ValuesOnly_03
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testUpdate_WithFreezing_ValuesOnly_03(self):
p = TreeDict()
p.b = 1
p.freeze(values_only=True)
q = TreeDict()
q.b = 2
self.assertRaises(TypeError, lambda: p.update(q))
示例2: testDangling_14_CorrectParentingSetAtFixing_03
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testDangling_14_CorrectParentingSetAtFixing_03(self):
p = TreeDict()
v = unique_object()
p.b = p.c
p.a = p.b
# Set c and fix p.b
p.c = 1
p.b = 1
p.a.x = 1
# Now b should be
self.assert_(p.a.branchName() == 'a')
示例3: testDangling_14_CorrectParentingSetAtFixing_05
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testDangling_14_CorrectParentingSetAtFixing_05(self):
p = TreeDict()
p.makeBranch('cc')
p.b = p.cc.c
p.aa.a = p.b
# Set c and fix p.b
p.cc.c = 1
p.b = 1
# Now b should be
self.assert_(p.aa.a.branchName() == 'a')
示例4: testMutability_03
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testMutability_03(self):
# Makes sure that stored branches are handled correctly
p1 = TreeDict('root')
p1.a = (13, (123, 32))
p1.b = 123
p1.c.a = 145
p1.c.b = "1231321321231321"
p2 = TreeDict('node')
p2.a = 432
p1.node = p2
self.assert_(p1.isMutable())
p1.freeze()
self.assert_(p1.isMutable())
p2.freeze()
self.assert_(not p1.isMutable())
示例5: testIterators_14_Links_are_not_branches_02
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testIterators_14_Links_are_not_branches_02(self):
p = TreeDict()
p.a.x = 1
p.b = p.a
self.assert_('b' not in p.keys(recursive = False, branch_mode = 'only'))
示例6: testOrdering_01
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testOrdering_01(self):
t = TreeDict()
t.a = 1
t.b = 2
self.assert_(t._getSettingOrderPosition('a') == (0,), t._getSettingOrderPosition('a'))
self.assert_(t._getSettingOrderPosition('b') == (1,), t._getSettingOrderPosition('b'))
示例7: test_existance_06b_dangling_node
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def test_existance_06b_dangling_node(self):
p = TreeDict('roor')
p.b = 123
p.a
self.assert_('b' in p)
self.assert_('a' not in p)
示例8: test01
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def test01(self):
test_tree = TreeDict()
test_tree.x = 1
test_tree.a = 1
test_tree.b = 2
runTest([], 'data', test_tree)
示例9: test02
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def test02(self):
test_tree = TreeDict()
test_tree.x = 1
test_tree.a = 10
test_tree.b = 2
runTest(['change_default_a'], 'data', test_tree)
示例10: test03
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def test03(self):
test_tree = TreeDict()
test_tree.x = 2
test_tree.a = 1
test_tree.b = 2
runTest(['data.set_X_2'], 'data', test_tree)
示例11: testCopying_07a_Regression
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testCopying_07a_Regression(self):
p = TreeDict()
p.a.b = [1,2,3,4,534]
p.a.c = [1,22,534]
p.b = [1,2,3]
p2 = TreeDict()
p2.a.b = [1,2,3,4,534]
p2.a.c = [1,22,534]
p2.b = [1,2,3]
p3 = copy(p)
self.assert_(p == p2)
self.assert_(p == p3)
示例12: testDrySet_04_value_overwrite
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testDrySet_04_value_overwrite(self):
p = TreeDict()
p.b = 1
p_before = p.copy()
self.assertRaises(TypeError, lambda: p.checkset("b.a", None, protect_structure = True))
self.assert_(p_before == p)
示例13: testPickling_Dangling_03
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testPickling_Dangling_03(self):
p = TreeDict()
p.a = p.b = p.c
p.b = 2
p2 = cPickle.loads(cPickle.dumps(p, protocol=2))
self.assert_(p2 == p)
示例14: testCopying_09_LinkedValuesPreserved
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testCopying_09_LinkedValuesPreserved(self):
p = TreeDict()
p.a.x = 1
p.b = p.a
q = p.copy()
self.assert_(p.a is not q.a)
self.assert_(q.b is q.a)
示例15: testDangling_11_ReferenceEquivalence_01
# 需要导入模块: from treedict import TreeDict [as 别名]
# 或者: from treedict.TreeDict import b [as 别名]
def testDangling_11_ReferenceEquivalence_01(self):
p = TreeDict()
b = p.a = p.b
self.assert_(p.a is p.b)
p.b = 1
self.assert_(p.a is b)