예제 #1
0
 def test_get_ancestors_on_nested_path(self):
     root = Tree('root')
     a = Tree('a')
     root.add_child(a)
     b = Tree('b')
     a.add_child(b)
     ancestors = list(b.get_ancestors())
     self.assertEqual(ancestors, [a, root])
예제 #2
0
 def test_get_ancestors(self):
     root = Tree('root')
     a = Tree('a')
     root.add_child(a)
     ancestors = list(a.get_ancestors())
     self.assertEqual(ancestors, [root])