def test_stack_peek(): stack = Stack() stack.push(7) stack.push(3) assert stack.peek() == 3
def test_stack_empty_exception(): stack = Stack() with pytest.raises(Exception): assert stack.pop() with pytest.raises(Exception): assert stack.peek()
def test_peek_S(): nums = Stack() nums.push(1) nums.push(2) expected = 2 assert expected == nums.peek()