Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
def _build_a_heap():
    heap = Heap()
    while len(heap) < len(NUMBERS):
        heap.push(random.choice(NUMBERS))
    return heap
Esempio n. 4
0
def _build_a_heap():
    heap = Heap()
    while len(heap) < len(NUMBERS):
        heap.push(random.choice(NUMBERS))
    return heap