Пример #1
0
def test_pq_pop_when_empty():
    """Ensures that an exception is raised when trying
    to pop() from an empty priority heap.
    """
    pq = PriorityQueue()
    with pytest.raises(IndexError):
        pq.pop()
Пример #2
0
def test_pop_single(create_pq):
    pq = PriorityQueue()
    pq.insert(1, "Almost missed this")
    assert pq.pop() == "Almost missed this"