コード例 #1
0
    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())
コード例 #2
0
    def testMutability_01(self):
        p1 = TreeDict('root')

        p1.a = (13, (123, 32))
        p1.b = 123
        p1.c.a = 145
        p1.c.b = "1231321321231321"

        self.assert_(p1.isMutable())

        p1.freeze()

        self.assert_(not p1.isMutable())