def test_push(): u"""Assert that the heap has correct head through multiple pushes.""" heap = Heap() numsPushed = [] for num in NUMBERS: heap.push(num) numsPushed.append(num) assert heap[0] == max(numsPushed)
def _build_a_heap(): heap = Heap() while len(heap) < len(NUMBERS): heap.push(random.choice(NUMBERS)) return heap