Exemplo n.º 1
0
    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'))
Exemplo n.º 2
0
    def testOrdering_02(self):

        t = TreeDict()

        t.a   = 1
        t.b.c = 2
        t.x.y = 3
        t.b.a = 4

        self.assert_(t._getSettingOrderPosition('a') == (0,),  t._getSettingOrderPosition('a'))
        self.assert_(t._getSettingOrderPosition('b') == (1,), t._getSettingOrderPosition('b'))
        self.assert_(t._getSettingOrderPosition('x') == (2,), t._getSettingOrderPosition('x'))
        self.assert_(t._getSettingOrderPosition('b.c') == (1,0), t._getSettingOrderPosition('b.c'))
        self.assert_(t._getSettingOrderPosition('b.a') == (1,1), t._getSettingOrderPosition('b.a'))
        self.assert_(t._getSettingOrderPosition('x.y') == (2,0), t._getSettingOrderPosition('x.y'))