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))
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))
def test_get_all_descendants_empty(self): root_node = Node("Root") self.assertListEqual(root_node.get_all_descendants(), [])
def test_get_all_descendants_empty(self): root_node = Node("Root") self.assertListEqual(root_node.get_all_descendants(), [])