def test_stacks_dequeue_multiple(): queue = PseudoQueue() queue.enqueue(1) queue.enqueue(2) queue.enqueue(3) queue.dequeue() queue.dequeue() assert queue.secound_stack.top.value == 3 assert queue.secound_stack.top.next == None
def test_PseudoQueue_dequeue_multi(): new_psQ = PseudoQueue() new_psQ.enqueue(3) new_psQ.enqueue(6) new_psQ.enqueue(9) new_psQ.enqueue(4) new_psQ.enqueue(7) new_psQ.enqueue(10) new_psQ.dequeue() new_psQ.dequeue() new_psQ.dequeue() assert new_psQ.__str__() == '{10} -> {7} -> {4} -> '
def test_enqueue_dequeue(my_stack): pseudo_q = PseudoQueue(my_stack) assert pseudo_q.stack1.peek() == 10 pseudo_q.enqueue('cat') assert pseudo_q.stack1.peek() == 'cat' pseudo_q.enqueue('dog') assert pseudo_q.stack1.peek() == 'dog' assert pseudo_q.dequeue() == 'a' assert pseudo_q.stack1.peek() == 'dog' assert pseudo_q.dequeue() == 'b' assert pseudo_q.stack1.peek() == 'dog' assert pseudo_q.dequeue() == 'c' assert pseudo_q.dequeue() == 10 assert pseudo_q.dequeue() == 'cat' assert pseudo_q.dequeue() == 'dog'
def test_PseudoQueue_dequeue(): new_psQ = PseudoQueue() new_psQ.enqueue(3) new_psQ.enqueue(6) new_psQ.enqueue(9) new_psQ.enqueue(4) new_psQ.enqueue(7) new_psQ.enqueue(10) assert new_psQ.dequeue() == 3
def test_failure_case(): pseudo_q = PseudoQueue() assert pseudo_q.dequeue() == "PseudoQueue is empty"
def test_dequeue_empty(): pseudo_q = PseudoQueue(Stack()) with pytest.raises(Exception): result = pseudo_q.dequeue()
def test_dequeue(my_stack): pseudo_q = PseudoQueue(my_stack) assert pseudo_q.dequeue() == 'a'
def test_PseudoQueue_dequeue_faliure_case(): new_psQ = PseudoQueue() assert new_psQ.dequeue() == "stack is empty!"
def test_dequeue(): queue = PseudoQueue() queue.enqueue(5) assert queue.dequeue() == 5