def test_items_pre_order_with_7_numbers(self): # Create a complete binary search tree of 7 items in level-order items = [4, 2, 6, 1, 3, 5, 7] tree = BinarySearchTree(items) # Ensure the pre-order traversal of tree items is ordered correctly assert tree.items_pre_order() == [4, 2, 1, 3, 6, 5, 7]
def test_items_pre_order(self): # Create a complete binary search tree of 7 items in level-order items = [4, 2, 6, 1, 3, 5, 7] bst = BinarySearchTree(items) assert bst.items_pre_order() == [4, 2, 1, 3, 6, 5, 7]
def test_items_pre_order_with_3_strings(self): # Create a complete binary search tree of 3 strings in level-order items = ['B', 'A', 'C'] tree = BinarySearchTree(items) # Ensure the pre-order traversal of tree items is ordered correctly assert tree.items_pre_order() == ['B', 'A', 'C']