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
def test_stack_pop(): stack = Stack() stack.push(1) stack.push(2) assert stack.pop() == 2
def test_pop_error(): stack = Stack() with pytest.raises(AttributeError) as err: assert stack.pop() assert str(err.value) == 'The stack is empty'