示例#1
0
def test_create_lunch_dinner_tree_length():
    bst = food_tree.BinarySearchTree()
    food_tree.create_tree(bst, 'Lunch/Dinner')
    data = bst.pre_order()
    actual = len(data)
    expected = 17
    assert actual == expected
示例#2
0
def test_create_lunch_dinner_tree():
    bst = food_tree.BinarySearchTree()
    food_tree.create_tree(bst, 'Lunch/Dinner')
    data = bst.pre_order()
    actual = data[-1]
    expected = 'Seafood'
    assert actual == expected
示例#3
0
def test_create_breakfast_tree():
    bst = food_tree.BinarySearchTree()
    food_tree.create_tree(bst, 'Breakfast')
    data = bst.pre_order()
    actual = data[-1]
    expected = 'Cafe'
    assert actual == expected
示例#4
0
def test_create_breakfast_tree_length():
    bst = food_tree.BinarySearchTree()
    food_tree.create_tree(bst, 'Breakfast')
    data = bst.pre_order()
    actual = len(data)
    expected = 7
    assert actual == expected
示例#5
0
def test_bst_create_root():
    # given        
    bst = food_tree.BinarySearchTree()
    expected = "The root is empty."
    # when
    actual = bst.__str__()
    # then
    assert actual == expected, 'Error creating an empty Binary Search Tree.'