Example #1
0
def test_stack_pop_multiple():
    stack = Stack()
    stack.push(1)
    stack.push(2)
    stack.push(3)
    assert stack.pop() == 3
    assert stack.pop() == 2
    assert stack.pop() == 1
Example #2
0
def test_stack_pop():
    stack = Stack()
    stack.push(1)
    stack.push(2)
    assert stack.pop() == 2
Example #3
0
def test_pop_error():
    stack = Stack()
    with pytest.raises(AttributeError) as err:
        assert stack.pop()
    assert str(err.value) == 'The stack is empty'