Ejemplo n.º 1
0
 def testTraverseByAttr(self):
     # simpleTraverse should find attr through attribute access
     ob = AttrTraversable()
     self.assertEqual(simpleTraverse(ob, ['attr'], None), 'foo')
Ejemplo n.º 2
0
 def testTraverseByItem(self):
     # simpleTraverse should find attr through item access
     ob = ItemTraversable()
     self.assertEqual(simpleTraverse(ob, ['attr'], None), 'foo')
Ejemplo n.º 3
0
 def testTraverseEmptyPath(self):
     # simpleTraverse should return the original object if the path is emtpy
     ob = object()
     self.assertEqual(simpleTraverse(ob, [], None), ob)
Ejemplo n.º 4
0
 def testTraverseByAll(self):
     # simpleTraverse should find attr through attribute access
     ob = AllTraversable()
     self.assertEqual(simpleTraverse(ob, ["attr"], None), "foo")
Ejemplo n.º 5
0
 def testTraverseByAttr(self):
     # simpleTraverse should find attr through attribute access
     ob = AttrTraversable()
     self.assertEqual(simpleTraverse(ob, ['attr'], None), 'foo')
Ejemplo n.º 6
0
 def testTraverseEmptyPath(self):
     # simpleTraverse should return the original object if the path is emtpy
     ob = object()
     self.assertEqual(simpleTraverse(ob, [], None), ob)
Ejemplo n.º 7
0
 def testTraverseByItem(self):
     # simpleTraverse should find attr through item access
     ob = ItemTraversable()
     self.assertEqual(simpleTraverse(ob, ['attr'], None), 'foo')