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