def test_adding_after_pop_min_on_last_element(self): heap = Heap(1) _ = heap.pop_min() # heap is now empty assert len(heap) == 0 heap.add_to_heap(2) self.assertEqual(len(heap), 1)
def test_pop_min_on_empty_heap_raises_error(self): heap = Heap(1) _ = heap.pop_min() # heap is now empty self.assertRaises(EmptyHeapError, heap.pop_min)