def test_abstract_list_pagination():
    """Yes indeed, the paginator can be used too without anything to actually
    be paginated. How quaint!
    """
    p = Paginator(query=None, page=1, per_page=20, total=490)

    assert p.page == 1
    assert not p.has_prev
    assert p.has_next
    assert p.total == 490
    assert p.num_pages == 25
    assert p.next_num == 2
    assert list(p.pages) == [1, 2, 3, 4, None, 24, 25]

    p.page = 10
    assert list(p.pages) == [1, 2, None, 7, 8, 9, 10, 11, 12, 13, None, 24, 25]
def test_list_pagination():
    """The paginator is a helper class that can be used with any iterable
    object.
    """
    items = range(1, 491)
    p = Paginator(items, page=1, per_page=20)

    assert p.page == 1
    assert not p.has_prev
    assert p.has_next
    assert p.total == 490
    assert p.num_pages == 25
    assert p.next_num == 2
    assert list(p.pages) == [1, 2, 3, 4, None, 24, 25]

    p.page = 10
    assert list(p.pages) == [1, 2, None, 7, 8, 9, 10, 11, 12, 13, None, 24, 25]
    assert list(p) == list(range(181, 201))