def test_post_order():
    tree = BinarySearchTree()
    tree.add(10)
    tree.add(9)
    tree.add(11)
    actual = tree.post_order()
    excepted = [9, 11, 10]
    assert actual == excepted
Exemple #2
0
def test_post_order():
    fruits = BinarySearchTree()
    fruits.add('bananas')
    fruits.add('apples')
    fruits.add('carrots')
    fruits.add('mango')
    fruits.add('pear')
    fruits.add('cake')
    fruits.add('cookies')
    fruits.add('beer')
    fruits.add('whiskey')
    expected = [
        'apples', 'beer', 'cake', 'carrots', 'cookies', 'mango', 'pear',
        'whiskey', 'bananas'
    ]
    actual = fruits.post_order()
    assert expected == actual