コード例 #1
0
 def test_extract_max_exception(self):
     max_heap = MaxHeap()  # storage is empty => should raise an exception
     max_heap.build_max_heap()
     with pytest.raises(Exception):
         max_heap.extract_max()
コード例 #2
0
 def test_extract_max(self):
     max_heap = MaxHeap(TestMaxHeap.storage)
     max_heap.build_max_heap()
     result = max_heap.extract_max()
     assert result == 16
     assert max_heap.heap_size == len(max_heap.storage) - 1