Example #1
0
def test_stack_push_pop():
    stk = Stack()
    stk.push(2)
    stk.push(3)
    assert stk.peek() == 3
    assert stk.pop() == 3
    assert stk.peek() == 2
    assert stk.pop() == 2
Example #2
0
def test_stack_swap():
    stk = Stack()
    stk.push(2)
    stk.push(3)
    stk.swap()
    assert stk.peek() == 2
    assert stk.pop() == 2
    assert stk.peek() == 3
    assert stk.pop() == 3