def test_insert_item_QNode_to_empty():
    node1 = QNode(10, priority=0)
    pqueue = PriorityQ()
    pqueue.insert(node1)
    assert len(pqueue) == 1
    assert pqueue[0].val == 10
    assert pqueue[0].priority == 0
def test_insert_item_QNode_to_empty():
    node1 = QNode(10, priority=0)
    pqueue = PriorityQ()
    pqueue.insert(node1)
    assert len(pqueue) == 1
    assert pqueue[0].val == 10
    assert pqueue[0].priority == 0
def test_empty_instantiation_args():
    tpq = PriorityQ()
    with pytest.raises(IndexError):
        tpq.pop()
def test_valid_instantiation_args(input):
    tpq = PriorityQ(input)
    assert tpq.pop() is not None
def test_insert_item_not_QNode_to_empty():
    queue = PriorityQ()
    queue.insert(50)
    assert len(queue) == 1
    assert queue[0].val == 50
    assert queue[0].priority is None
def test_PriorityQ_init_empty():
    pqueue = PriorityQ()
    assert isinstance(pqueue, PriorityQ)
    assert len(pqueue) == 0
def test_invalid_number_args_priorityq():
    with pytest.raises(TypeError):
        tpq = PriorityQ(1, 2)
def test_invalid_instantiation_args(input):
    with pytest.raises(TypeError):
        tpq = PriorityQ(input)
def test_empty_instantiation_args():
    tpq = PriorityQ()
    with pytest.raises(IndexError):
        tpq.pop()
def test_valid_instantiation_args(input):
    tpq = PriorityQ(input)
    assert tpq.pop() is not None
def base_pqueue(QNode_list):
    return PriorityQ(QNode_list)
def test_insert_item_not_QNode_to_empty():
    queue = PriorityQ()
    queue.insert(50)
    assert len(queue) == 1
    assert queue[0].val == 50
    assert queue[0].priority is None
def test_PriorityQ_init_iterable_with_QNodes(QNode_list):
    pqueue = PriorityQ(QNode_list)
    assert len(pqueue) == 3
    assert pqueue[0].val == 100
    assert pqueue[0].priority == 1
def test_PriorityQ_init_iterable_no_QNodes():
    pqueue = PriorityQ([10, 9, 8, 7, 6, 5])
    assert len(pqueue) == 6
    assert pqueue[0].val == 10
    assert pqueue[0].priority is None