def test_enqueue_two(): q = Queue() q.enqueue("apples") q.enqueue("bananas") actual = q.peek() expected = "apples" assert actual == expected
def test_peek(): q = Queue() q.enqueue("apple") q.enqueue("banana") q.enqueue("cucumber") actual = q.peek() expected = "apple" assert actual == expected
def test_dequeue(): q = Queue() q.enqueue("apple") q.enqueue("banana") q.dequeue() actual = q.peek() expected = "banana" assert actual == expected
def test_peek_queue_long(): s = Queue() s.enqueue("apple") s.enqueue("cucumber") s.enqueue("phone") actual = s.peek() expected = "apple" assert actual == expected
def test_peek_when_empty(): q = Queue() with pytest.raises(InvalidOperationError) as e: q.peek() assert str(e.value) == "Method not allowed on an empty collection"
def test_peek_queue(): s = Queue() s.enqueue("apple") actual = s.peek() expected = "apple" assert actual == expected
def test_peek_when_empty(): q = Queue() with pytest.raises(InvalidOperationError): q.peek()
def test_peek_on_empty_queue(): new_queue = Queue() with pytest.raises(InvalidOperationError) as e: new_queue.peek() assert str(e.value) == "Method not allowed on empty collection"