Ejemplo n.º 1
0
    def test_get_all_descendants(self):
        root_node = Node("Root")
        child1 = Node("Child1")
        child2 = Node("Child2")
        root_node.add_child("child1", child1)
        root_node.add_child("child2", child2)

        grandchild1 = Node("GC1")
        grandchild2 = Node("GC2")
        child2.add_child("child1", grandchild1)
        child2.add_child("child2", grandchild2)

        assert_that(
            root_node.get_all_descendants(),
            contains_inanyorder(child1, child2, grandchild1, grandchild2))
Ejemplo n.º 2
0
 def test_get_all_descendants(self):
     root_node = Node("Root")
     child1 = Node("Child1")
     child2 = Node("Child2")
     root_node.add_child("child1", child1)
     root_node.add_child("child2", child2)
     
     grandchild1 = Node("GC1")
     grandchild2 = Node("GC2")
     child2.add_child("child1", grandchild1)
     child2.add_child("child2", grandchild2)
     
     assert_that(
         root_node.get_all_descendants(),
         contains_inanyorder(
             child1, child2, grandchild1, grandchild2))
Ejemplo n.º 3
0
 def test_get_all_descendants_empty(self):
     root_node = Node("Root")
     self.assertListEqual(root_node.get_all_descendants(), [])
Ejemplo n.º 4
0
 def test_get_all_descendants_empty(self):
     root_node = Node("Root")
     self.assertListEqual(root_node.get_all_descendants(), [])