예제 #1
0
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
예제 #2
0
def test_push_sets_the_element_on_top():
    stack = Stack()
    
    stack.push(42)
    
    assert stack.peek() == 42
예제 #3
0
def test_peek_on_empty_stack_returns_none():
    stack = Stack()
    
    assert stack.peek() == None
예제 #4
0
def test_peek_returns_the_element_on_top():
    stack = Stack()
    stack.push(42)

    assert stack.peek() == 42