def test_Children_SingleChild(self): grandParent = KeyedNode("grand pa") parent = KeyedNode("pa") child = KeyedNode("me") child.set_parent(parent) parent.set_parent(grandParent) self.assertListEqual(child.get_child_nodes(), []) self.assertListEqual(parent.get_child_nodes(), [child]) self.assertListEqual(grandParent.get_child_nodes(), [parent])
def test_Children_MultipleChildren(self): grandParent = KeyedNode("grand pa") parent = KeyedNode("pa") aunt = KeyedNode("aunt") uncle = KeyedNode("uncle") me = KeyedNode("me") brother = KeyedNode("bro") sister = KeyedNode("si") me.set_parent(parent) brother.set_parent(parent) sister.set_parent(parent) parent.set_parent(grandParent) aunt.set_parent(grandParent) uncle.set_parent(grandParent) self.assertListEqual(me.get_child_nodes(), []) self.assertListEqual(parent.get_child_nodes(), [me, brother, sister]) self.assertListEqual(grandParent.get_child_nodes(), [parent, aunt, uncle])
def test_Children_DefaultEmpty(self): child = KeyedNode("me") self.assertListEqual(child.get_child_nodes(), [])