Exemplo n.º 1
0
def test_delete_from_one_element_heap():
    heap = Heap([1])
    heap.delete()

    expected = [0]
    output = heap.heap
    assert output == expected
Exemplo n.º 2
0
def test_delete_from_empty_heap():
    heap = Heap()
    heap.delete()

    expected = [0]
    output = heap.heap
    assert output == expected
Exemplo n.º 3
0
def test_delete_from_full_heap():
    heap = Heap([9, 7, 5, 6, 2])
    deleted_node = heap.delete()

    expected = [0, 7, 6, 5, 2]
    output = heap.heap
    assert output == expected
    assert deleted_node == 9
Exemplo n.º 4
0
def test_delete_from_two_element_heap():
    heap = Heap([5, 1])
    deleted_node = heap.delete()

    expected = [0, 1]
    output = heap.heap
    assert output == expected
    assert deleted_node == 5