Exemplo n.º 1
0
 def test_increase_key_exception(self):
     max_heap = MaxHeap([1, 2, 3])
     max_heap.build_max_heap()
     with pytest.raises(Exception):
         assert max_heap.increase_key(
             2, 0)  # 0 < 3, hence will raise exception
Exemplo n.º 2
0
 def test_increase_key(self):
     max_heap = MaxHeap(TestMaxHeap.storage)
     max_heap.build_max_heap()
     max_heap.increase_key(3, 17)  # increase the value at index 3 to 12
     assert max_heap.maximum() == 17