def test_peek():
    s = Stack()
    s.push("apple")
    s.push("banana")
    actual = s.peek()
    expected = "banana"
    assert actual == expected
def test_stack():
    stack = Stack()
    with pytest.raises(InvalidOperationError) as error:
        stack.peek()
    assert str(error.value) == "Method not allowed on empty collection."
def test_peek_empty():
    s = Stack()
    with pytest.raises(InvalidOperationError) as e:
        s.peek()

    assert str(e.value) == "Method not allowed on empty collection"