def testTraverseByAttr(self): # simpleTraverse should find attr through attribute access ob = AttrTraversable() self.assertEqual(simpleTraverse(ob, ['attr'], None), 'foo')
def testTraverseByItem(self): # simpleTraverse should find attr through item access ob = ItemTraversable() self.assertEqual(simpleTraverse(ob, ['attr'], None), 'foo')
def testTraverseEmptyPath(self): # simpleTraverse should return the original object if the path is emtpy ob = object() self.assertEqual(simpleTraverse(ob, [], None), ob)
def testTraverseByAll(self): # simpleTraverse should find attr through attribute access ob = AllTraversable() self.assertEqual(simpleTraverse(ob, ["attr"], None), "foo")