def run(): heap = Heap() data = [0, 5, 9, 11, 14, 18, 19, 21, 33, 17, 27] size = len(data[1:]) heap._heap = data assert (heap.size == size) heap.insert(7) assert (heap._heap[2] == 7) assert (heap.size == size + 1) smallest_value = heap.delete_min() assert (smallest_value == 5) assert (heap.size == size)
import pytest from heap import Heap """ TEST DATA """ tmp_heap_1 = Heap() tmp_heap_1._heap = [5, 2, 12, 4] tmp_heap_2 = Heap() tmp_heap_2._heap = [5, 12, 2, 4] test_swap_data = { 0: { 'i': 1, 'j': 2, 'input_heap': tmp_heap_1, 'expected_heap': tmp_heap_2 }, } tmp_expected_heap = Heap() tmp_expected_heap._size = 5 test_set_heap_size_data = { 0: { 'input_heap': Heap(), 'size': 5, 'expected_heap': tmp_expected_heap } } test_get_heap_size_data = { 0: { 'input_heap': tmp_expected_heap,