def test_find_maximum_value_tree_with_two_values():
    one_value = BST([10, 2])
    assert find_maximum_value(one_value) == 10
def test_find_maximum_value_right():
    right = BST([1, 3, 5, 7, 9])
    assert find_maximum_value(right) == 9
def test_find_maximum_value_tree_with_one_value():
    one_value = BST([5])
    assert find_maximum_value(one_value) == 5
def test_find_maximum_value_left():
    left = BST([10, 8, 6, 4])
    assert find_maximum_value(left) == 10
def test_find_maximum_value_balanced():
    balanced = BST([10, 7, 3, 16, 12, 8, 20])
    assert find_maximum_value(balanced) == 20
Пример #6
0
def test_max_none(capsys):
    """No output."""
    a = BST()
    assert find_maximum_value(a) is None
Пример #7
0
def test_max_unbalanced(tree):
    """Correct output order."""
    tree.insert(4)
    assert find_maximum_value(tree) == 16
Пример #8
0
def test_max(tree):
    """Correct output order."""
    assert find_maximum_value(tree) == 16