def testTraverse(self): tree = Tree() for word in insert_queue: tree.insert(word) insert_queue.sort() self.assertEqual(tree.inorder_traverse(), " ".join(insert_queue))
def testDelete(self): tree = Tree() copy_q = copy(insert_queue) for word in copy_q: tree.insert(word) tree.delete(copy_q[-1]) self.assertEqual(tree.search(copy_q[-1]), None) copy_q.pop() copy_q.sort() self.assertEqual(tree.inorder_traverse(), " ".join(copy_q))