Ejemplo n.º 1
0
def test_pop():
    """Test if entry sorts to the correct position."""
    from binheap import Heap
    heap = Heap()
    heap.container = [2, 3, 4, 10]
    heap.pop()
    assert heap.container == [10, 3, 4]
Ejemplo n.º 2
0
def test_pop():
    """."""
    from binheap import Heap
    heap = Heap()
    heap.push(1)
    heap.push(2)
    heap.push(3)
    assert heap.pop() == 3
Ejemplo n.º 3
0
def test_pop_all_nodes():
    """."""
    from binheap import Heap
    heap = Heap()
    test_list = [97, 12, 13, 55, 108]
    temp_list = []
    for i in test_list:
        heap.push(i)
    for i in test_list:
        temp_list.append(heap.pop())
    assert temp_list == [108, 97, 55, 13, 12]