def test_dequeue():
    pseudo = PseudoQueue()
    pseudo.enqueue(1)
    pseudo.enqueue(2)
    pseudo.enqueue(3)
    pseudo.enqueue(4)
    pseudo.dequeue()
    assert pseudo.stck1.peek() == 2
def test_peek_post_dequeue():
    q = PseudoQueue()
    q.enqueue("apples")
    q.enqueue("bananas")
    q.dequeue()
    actual = q.stack1.peek()
    expected = "bananas"
    assert actual == expected
def test_enqueue_and_dequeue_many():
    p = PseudoQueue()
    p.enqueue('A')
    p.enqueue('B')
    assert p.dequeue() == 'A'
    p.enqueue('C')
    p.enqueue('D')
    assert p.dequeue() == 'B'
    assert p.dequeue() == 'C'
def test_exhausted():
    q = PseudoQueue()
    q.enqueue("apple")
    q.enqueue("banana")
    q.enqueue("cucumber")
    q.dequeue()
    q.dequeue()
    q.dequeue()
    actual = q.stack1.is_empty()
    expected = True
    assert actual == expected
def test_dequeue_until_empty():
    pseudo = PseudoQueue()
    pseudo.enqueue(1)
    pseudo.enqueue(2)
    pseudo.enqueue(3)
    pseudo.enqueue(4)
    pseudo.dequeue()
    pseudo.dequeue()
    pseudo.dequeue()
    pseudo.dequeue()
    with pytest.raises(AttributeError):
        pseudo.stck1.peek()
def test_enqueue_and_dequeue_all():
    p = PseudoQueue()
    p.enqueue('A')
    p.enqueue('B')
    p.enqueue('C')
    p.enqueue('D')
    p.enqueue('E')
    assert p.dequeue() == 'A'
    assert p.dequeue() == 'B'
    assert p.dequeue() == 'C'
    assert p.dequeue() == 'D'
    assert p.dequeue() == 'E'
    assert p.dequeue() is None
def test_dequeue():
    pseudo_queue = PseudoQueue()

    pseudo_queue.enqueue("one")
    pseudo_queue.enqueue("two")
    pseudo_queue.enqueue("three")

    pseudo_queue.dequeue()

    expected = "two\nthree"

    actual = f"{pseudo_queue}"

    assert expected == actual
def test_dequeue_when_full():
    q = PseudoQueue()
    q.enqueue("apples")
    q.enqueue("bananas")
    actual = q.dequeue()
    expected = "apples"
    assert actual == expected
def test_dequeue():
    q = PseudoQueue()
    q.enqueue("apple")
    q.enqueue("banana")
    actual = q.dequeue()
    expected = "apple"
    assert actual == expected
def test_can_successfully_dequeue():
    new_queue = PseudoQueue()
    new_queue.enqueue(5)
    expected = 5
    actual = new_queue.dequeue()

    assert expected == actual
Ejemplo n.º 11
0
def test_dequeue():
    pq = PseudoQueue()
    pq.enqueue(5)
    pq.enqueue(3)
    pq.enqueue(1)
    actual = pq.dequeue()
    expected = 5
    assert actual == expected
def test_dequeue_from_empty():
    pseudo_queue = PseudoQueue()

    expected = "empty stack"

    actual = pseudo_queue.dequeue()

    assert expected == actual
Ejemplo n.º 13
0
def test_dequeue():
  pq = PseudoQueue()
  pq.enqueue(20)
  pq.enqueue(5)
  pq.enqueue(10)
  pq.enqueue(15)
  actual = pq.dequeue()
  expected = 20
  assert actual == expected
def test_dequeue_when_empty():
    q = PseudoQueue()
    with pytest.raises(InvalidOperationError):
        q.dequeue()
def test_can_successfully_throw_a_dequeue_exception():
    new_queue = PseudoQueue()
    expected = "Exception"
    actual = new_queue.dequeue()
    assert expected == actual
def test_enqueue_and_dequeue_one():
    p = PseudoQueue()
    p.enqueue('A')
    assert p.dequeue() == 'A'