def test_traverse_pre_order():
    tree = BinarySearchTree()
    tree.add('bananas')
    tree.add('apples')
    tree.add('cucumbers')

    items = list(tree.traverse_pre_order())

    assert items == ['bananas', 'apples', 'cucumbers']
def test_traverse_for_loop_pre_order():
    tree = BinarySearchTree()
    tree.add('bananas')
    tree.add('apples')
    tree.add('cucumbers')

    items = []

    for item in tree.traverse_pre_order():
        items.append(item)

    assert items == ['bananas', 'apples', 'cucumbers']