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

    items = list(tree.traverse_post_order())

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

    items = []

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

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