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_given_elements_then_traverse_preorder_should_return_elements_in_preorder_with_parents_first(
        input_elements, expected_output):
    object_under_test = RedBlackTree()

    for ele in input_elements:
        object_under_test.insert(value=ele)

    assert expected_output == object_under_test.traverse_preorder()