def paginator(): return mod.Paginator(range(10), 1, 20)
def test_items(): assert mod.Paginator(range(100), 3, 20).items == range(40, 60) assert mod.Paginator(range(100), 1, 30).items == range(0, 30) assert mod.Paginator(range(110), 4, 30).items == range(90, 110)
def test_has_next(): assert mod.Paginator(range(100), 1, 20).has_next assert not mod.Paginator(range(10), 1, 20).has_next assert not mod.Paginator(range(100), 5, 20).has_next
def test_has_prev(): assert mod.Paginator(range(100), 3, 20).has_prev assert not mod.Paginator(range(10), 1, 20).has_prev assert not mod.Paginator(range(100), 1, 20).has_prev
def test_pages(paginator): assert mod.Paginator(range(100), 1, 20).pages == 5 assert mod.Paginator(range(1000), 1, 30).pages == 34