Beispiel #1
0
def test_recent_items_queue_update_and_pop():
    ris = RecentItemStack(4)
    items = [8, 2, 6, 4, 5, 7]
    for item in items:
        ris.push(item)
    eq_(len(ris), 4)
    for item in reversed(items[-4:]):
        eq_(ris.pop(), item)
    eq_(len(ris), 0)
Beispiel #2
0
def test_recent_items_size_zero():
    ris = RecentItemStack(0)
    eq_(list(ris), [])
    ris.push(1)
    eq_(list(ris), [])
    eq_(ris.pop(), None)
Beispiel #3
0
def test_recent_items_pop_empty():
    ris = RecentItemStack(4)
    eq_(len(ris), 0)
    assert ris.pop() is None