def test_delete_removes_target_item_from_heap(): heap = Heap(5) heap.insert(1) heap.insert(3) heap.insert(2) heap.insert(4) heap.delete(3) assert heap.get_size() == 3 assert heap.extract() == 4 assert heap.extract() == 2
def test_delete_raises_exception_if_value_not_present(): heap = Heap(5) heap.insert(1) with pytest.raises(Exception): heap.delete(4)