def testChildIsInChildren(self): tree, child = Tree(), Tree() tree.addChild(child) actual = (child in tree.children()) self.assertTrue(actual)
def testDataIsStored(self): expected = 1 tree = Tree(expected) actual = tree.data() self.assertEquals(expected,actual)
def __init__(self, data = None): Tree.__init__(self,data)
def testDefaultDataIsNone(self): tree = Tree() actual = tree.data() self.assertEquals(None, actual)
def testAddingAChildDoesMakeAChild(self): tree = Tree().addChild(Tree()) actual = tree.hasChildren() self.assertTrue(actual)
def testDefaultNoChildren(self): tree = Tree() actual = tree.hasChildren() self.assertFalse(actual)