Exemple #1
0
def test_search_deve_buscar_um_valor_a_partir_de_um_indice():
    queue = Queue()
    queue.enqueue(42)
    queue.enqueue(43)
    queue.enqueue(44)
    assert queue.search(0) == 42
    assert queue.search(1) == 43
    assert queue.search(2) == 44
Exemple #2
0
def test_search_com_indice_invalido():
    queue = Queue()
    with pytest.raises(IndexError):
        queue.search(0)
    queue.enqueue(42)
    with pytest.raises(IndexError):
        queue.search(-1)
    with pytest.raises(IndexError):
        queue.search(2)