示例#1
0
    def testDangling_13_CorrectCountsThroughSiblingReferences(self):

        p = TreeDict()

        p.a = p.d
        self.assert_(p._numDangling() == 2)

        # Overwrite p.d; p.a still points to the dangling node, so the
        # count should not go down.

        p.d = 1
        self.assert_(p._numDangling() == 1)
    def testIterators_12_Deletion(self):
        p = TreeDict()

        p.a = 1
        p.b = 2
        p.c = 3
        p.d = 4 
        p.e = 5

        it = p.iterkeys()
        
        self.assertRaises(RuntimeError, lambda: p.pop('a'))
        it.next()
        self.assertRaises(RuntimeError, lambda: p.pop('a'))
        
        del it

        p.pop('a')
示例#3
0
    def testBranch_05_Overwrite(self):
        # Decided this is okay

        p = TreeDict()
        p.d.a = 1
        p.d = 1