Пример #1
0
def test_straight_order():
    s = Stack(reverse=False)
    s('first')
    s('second')
    s('third')
    assert s.top() == ('third',)
    assert s.bottom() == ('first',)
    assert list(s) == [('first',), ('second',), ('third',)]
Пример #2
0
def test_default_reverse_order():
    s = Stack()  # This is the default
    s('first')
    s('second')
    s('third')
    assert len(s) == 3
    assert s.top() == ('first',)
    assert s.bottom() == ('third',)
    assert list(s) == [('third',), ('second',), ('first',)]