def testhashes_15_attaching(self): p1 = TreeDict('root') p1.b1 = TreeDict('b1') h = p1.hash() p1.attach(copy = False, recursive = True) self.assert_(p1.hash() != h)
def testAttaching_11_equalityTesting_01(self): p1 = TreeDict('root') p1.b1 = TreeDict('new_branch') p1.b1.b2 = TreeDict('new_branch') p1.b1.b2.b3 = TreeDict('new_branch') p2 = p1.copy() self.assert_(p2 == p1) p1.attach(copy=False, recursive=True) self.assert_(p2 != p1)
def testRecursiveAttach_05_ValueFrozen(self): # Disable; not sure it's best anyway return p1 = TreeDict('root') p1.b1 = TreeDict('new_branch') p1.freeze(values_only = True) self.assert_(p1.b1.isRoot()) self.assert_(p1.b1.branchName(True,True) == 'new_branch') p1.attach(copy=True, recursive=True) self.assert_(p1.b1.rootNode() is p1) self.assert_(p1.b1.branchName(True,True) == 'root.b1')
def testRecursiveAttach_01(self): p1 = TreeDict('root') p1.b1 = TreeDict('new_branch') p1.b1.b2 = TreeDict('new_branch') p1.b1.b2.b3 = TreeDict('new_branch') self.assert_(p1.b1.isRoot()) self.assert_(p1.b1.b2.isRoot()) self.assert_(p1.b1.b2.b3.isRoot()) self.assert_(p1.b1.branchName(True,True) == 'new_branch') self.assert_(p1.b1.b2.branchName(True,True) == 'new_branch') self.assert_(p1.b1.b2.b3.branchName(True,True) == 'new_branch') p1.attach(copy=True, recursive=True) self.assert_(p1.b1.rootNode() is p1) self.assert_(p1.b1.b2.rootNode() is p1) self.assert_(p1.b1.b2.b3.rootNode() is p1) self.assert_(p1.b1.branchName(True,True) == 'root.b1') self.assert_(p1.b1.b2.branchName(True,True) == 'root.b1.b2') self.assert_(p1.b1.b2.b3.branchName(True,True) == 'root.b1.b2.b3')