def test_dequeue_when_full():
    q = PseudoQueue()
    q.enqueue("apples")
    q.enqueue("bananas")
    actual = q.dequeue()
    expected = "apples"
    assert actual == expected
def queue_test():
    queue = PseudoQueue()
    queue.enqueue(4)
    queue.enqueue(3)
    queue.enqueue(2)
    queue.enqueue(1)
    return queue
def test_enqueue_two():
    q = PseudoQueue()
    q.enqueue("apples")
    q.enqueue("bananas")
    actual = q.stack1.peek()
    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_pseudoqueue_enqueue_several():
    q = PseudoQueue()
    q.enqueue("orange")
    q.enqueue("apple")
    actual = q.input.peek()
    expected = "apple"
    assert actual == expected
Exemple #6
0
def test_dequeue_one():
  q = PseudoQueue()
  q.enqueue('monkey')
  q.enqueue('business')
  actual1 = q.dequeue()
  expected1 = 'monkey'
  assert actual1 == expected1
def test_peek_post_dequeue():
    q = PseudoQueue()
    q.enqueue("apples")
    q.enqueue("bananas")
    q.dequeue()
    actual = q.stack1.peek()
    expected = "bananas"
    assert actual == expected
Exemple #8
0
def test_dequeue_empty_after_multiple_dequeue():
  q = PseudoQueue()
  q.enqueue('monkey')
  q.enqueue('business')
  q.dequeue()
  q.dequeue()
  with pytest.raises(InvalidOperationError) as e:
    q.dequeue()
  assert str(e.value) == 'Method not allowed on an empty collection'
Exemple #9
0
def test_enqueue_first_node():
  q = PseudoQueue()
  q.enqueue('monkey')
  actual1 = q.front.peek()
  expected1 = 'monkey'
  assert actual1 == expected1
  actual2 = q.rear.peek()
  expected2 = 'monkey'
  assert actual2 == expected2
Exemple #10
0
def test_peek_2():
    q = Queue()
    q.enqueue("apple")
    q.enqueue("banana")
    q.enqueue("cucumber")
    actual = q.peek()
    expected = "apple"
    assert actual == expected
def test_peek():
    q = PseudoQueue()
    q.enqueue("apple")
    q.enqueue("banana")
    q.enqueue("cucumber")
    actual = q.stack1.peek()
    expected = "apple"
    assert actual == expected
def test_pseudoqueue_dequeue_several():
    q = PseudoQueue()
    q.enqueue("orange")
    q.enqueue("apple")
    q.enqueue("lime")
    q.dequeue()
    q.dequeue()
    actual = q.dequeue()
    expected = "orange"
    assert actual == expected
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_pseudoqueue_dequeue_one():
    q = PseudoQueue()
    q.enqueue("orange")
    actual = q.dequeue()
    expected = "orange"
    assert actual == expected
def test_enqueue():
    q = PseudoQueue()
    q.enqueue("apple")
    actual = q.stack1.top.value
    expected = "apple"
    assert actual == expected
Exemple #16
0
def test_enqueue_one():
    q = Queue()
    q.enqueue("apples")
    actual = q.peek()
    expected = "apples"
    assert actual == expected
Exemple #17
0
def test_enqueue_two():
  q = PseudoQueue()
  q.enqueue('monkey')
  q.enqueue('business')
  assert q.front.peek() == 'monkey'
  assert q.rear.peek() == 'business'
def test_queue_enqueue():
    expected = "5"
    queue = PseudoQueue()
    queue.enqueue(5)
    actual = f"{queue}"
    assert actual == expected
Exemple #19
0
def test_enqueue():
    q = Queue()
    q.enqueue("apple")
    actual = q.front.value
    expected = "apple"
    assert actual == expected