Exemplo n.º 1
0
def test_deleting_only_node_should_leave_the_tree_empty():
    object_under_test = RedBlackTree()
    object_under_test.insert(22)

    object_under_test.delete(22)

    assert not object_under_test.traverse_preorder()
Exemplo n.º 2
0
def test_deleting_nonexistent_value_should_raise():
    object_under_test = RedBlackTree()
    object_under_test.insert(44)

    nonexistent_value = 22

    with pytest.raises(ValueNotFoundInTreeError) as err:
        object_under_test.delete(nonexistent_value)

    assert f"{nonexistent_value}" in str(err)