def test_addingChildren(self): c = Node("c", False) a = Node("a", False) t = Node("t", True, "cat") c.addChild(a) a.addChild(t) self.assertEqual(c.children, {"a": a}) self.assertEqual(a.children, {"t": t})
def test_getting_children(self): c = Node("c", False) a = Node("a", False) t = Node("t", True, "cat") c.addChild(a) a.addChild(t) self.assertEqual(c.getChild("a"), a) self.assertEqual(a.getChild("t"), t) self.assertEqual(c.getChild("b"), Node("", False))