예제 #1
0
 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})
예제 #2
0
 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))