def test_peek_does_not_change_the_stack_size(): stack = Stack() stack.push(42) previous_size = stack.size stack.peek() assert stack.size == previous_size
def test_push_sets_the_element_on_top(): stack = Stack() stack.push(42) assert stack.peek() == 42
def test_peek_on_empty_stack_returns_none(): stack = Stack() assert stack.peek() == None
def test_peek_returns_the_element_on_top(): stack = Stack() stack.push(42) assert stack.peek() == 42