コード例 #1
0
 def test_after_single_push_find_max_returns_value(self):
     heap = MaxHeap()
     heap.insert(0)
     assert heap.find_max() == 0
コード例 #2
0
 def test_after_two_pushes_find_max_finds_larger_value(self):
     heap = MaxHeap()
     heap.insert(0)
     heap.insert(1)
     assert heap.find_max() == 1
コード例 #3
0
 def test_find_max_of_empty_heap_raises_exception(self):
     heap = MaxHeap()
     with raises(MaxHeap.EmptyHeapException):
         heap.find_max()