Example #1
0
 def test_construction1(self):
     a = Node('a')
     assert a.name == 'a'
     assert a.parents == []
     assert a.children == []
     assert a.is_root()
     assert a.is_leaf()
Example #2
0
 def test_construction(self):
     a = Node('a')
     b = Node('b')
     c = Node('c', b)
     d = Node('d', a, c)
     e = Node('e', d)
     f = Node('f', d, c)
     g = Node('g', e, f)
     assert b.is_root()
     assert c.parents == [b]
     assert d.parents == [a, c]
     assert g.parents == [e, f]
     assert b.children == [c]
     assert c.children == [d, f]
     assert g.is_leaf()