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

    assert stack.peek() == 42