示例#1
0
def test_Queue_dequeue_multiple_items():
    my_queue = Queue()
    my_queue.enqueue(1)
    my_queue.enqueue(2)
    my_queue.enqueue(3)
    my_queue.dequeue()
    actual = my_queue.dequeue()
    expected = 2
    assert actual == expected
示例#2
0
def test_Queue_isEmpty_not_empty():
    my_queue = Queue()
    my_queue.enqueue(1)
    my_queue.enqueue(2)
    my_queue.enqueue(3)
    actual = my_queue.is_empty()
    expected = False
    assert actual == expected
示例#3
0
def test_Queue_peek_front():
    my_queue = Queue()
    my_queue.enqueue(1)
    my_queue.enqueue(2)
    my_queue.enqueue(3)
    actual = my_queue.peek()
    expected = 1
    assert actual == expected
示例#4
0
def test_Queue_enqueue_multiple_items():
    my_queue = Queue()
    my_queue.enqueue(1)
    my_queue.enqueue(2)
    my_queue.enqueue(3)
    actual = my_queue.peek()
    expected = 1
    assert actual == expected
示例#5
0
def test_Queue_isEmpty_empty():
    my_queue = Queue()
    actual = my_queue.is_empty()
    expected = True
    assert actual == expected
示例#6
0
def test_Queue_peek_empty_Exception():
    with pytest.raises(AttributeError):
        my_queue = Queue()
        actual = my_queue.peek()
        expected = "Can't peek front from an empty queue"
        assert actual == expected
示例#7
0
def test_Queue_dequeue_one_item():
    my_queue = Queue()
    my_queue.enqueue(1)
    actual = my_queue.dequeue()
    expected = 1
    assert actual == expected
示例#8
0
def test_Queue_exists():
    assert Queue()