示例#1
0
def test_peek(m_eq, m_lbh, m_hbl):
    assert isinstance(m_eq.peek(), type(None))

    assert m_lbh.peek() == -1
    assert m_hbl.peek() == -1

    # Only low priority items in the list.
    q = Priority_Queue(2)
    q.insert('eh', 1)
    assert q.peek() == 'eh'
    q.insert('again', 1)
    assert q.peek() == 'eh'
def test_insert_into_empty_queue():
    pq = Priority_Queue()
    pq.insert(PNode("thirty", 30))
    assert pq.peek() == "thirty"
def test_insert_into_empty_queue():
    pq = Priority_Queue()
    pq.insert(PNode('thirty', 30))
    assert pq.peek() == 'thirty'