def testDictBehavior_08_equality_tests(self):
        p = TreeDict()

        p.v = 1
        p.a.b.c = 2
    
        self.assert_(p == {'v' : 1, "a.b.c" : 2})
        self.assert_(p != {'v' : 2, "a.b.c" : 2})
        self.assert_(p != {'v' : 1, "a.b.c" : None})
Beispiel #2
0
def basic_walking_test():
    p = TreeDict()

    p.a.b.v = 1
    p.a.v = 1
    p.makeBranch("b")
    p.v = 1

    p.freeze()

    required_item_dict = { 
        (True, "none"): set([ ("a.b.v", 1), 
                              ("v",     1),       
                              ("a.v",   1) ]),

        (True, "all") : set([ ("a.b.v", 1), 
                              ("v",     1),       
                              ("a.v",   1),
                              ("a",     p.a),   
                              ("a.b",   p.a.b), 
                              ("b",     p.b)  ]),

        (True, "only"): set([ ("a",     p.a),   
                              ("a.b",   p.a.b), 
                              ("b",     p.b) ]),

        (False, "none"): set([("v",     1)  ]),

        (False, "all") : set([("v",     1), 
                              ("a",     p.a), 
                              ("b",     p.b)]),
        
        (False, "only"): set([ ("a",    p.a),   
                               ("b",    p.b) ])}
    
    return (p, required_item_dict)