Ticket #7669: pagination.diff

File pagination.diff, 1.7 KB (added by Alex Gaynor, 16 years ago)

Fixes broken tests

  • tests/modeltests/pagination/models.py

    diff --git a/tests/modeltests/pagination/models.py b/tests/modeltests/pagination/models.py
    index 1f08a32..fe2e71a 100644
    a b __test__ = {'API_TESTS':"""  
    3131# New/current API (Paginator/Page) #
    3232####################################
    3333
    34 >>> from django.core.paginator import Paginator, InvalidPage
     34>>> from django.core.paginator import Paginator, EmptyPage
    3535>>> paginator = Paginator(Article.objects.all(), 5)
    3636>>> paginator.count
    37379
    True  
    8282>>> p.end_index()
    83839
    8484
    85 # Invalid pages raise InvalidPage.
     85# Invalid pages raise EmptyPage.
    8686>>> paginator.page(0)
    8787Traceback (most recent call last):
    8888...
    89 InvalidPage: ...
     89EmptyPage: ...
    9090>>> paginator.page(3)
    9191Traceback (most recent call last):
    9292...
    93 InvalidPage: ...
     93EmptyPage: ...
    9494
    9595# Empty paginators with allow_empty_first_page=True.
    9696>>> paginator = Paginator(Article.objects.filter(id=0), 5, allow_empty_first_page=True)
    True  
    148148>>> from warnings import filterwarnings
    149149>>> filterwarnings("ignore")
    150150
    151 >>> from django.core.paginator import ObjectPaginator, InvalidPage
     151>>> from django.core.paginator import ObjectPaginator, EmptyPage
    152152>>> paginator = ObjectPaginator(Article.objects.all(), 5)
    153153>>> paginator.hits
    1541549
    True  
    181181>>> paginator.last_on_page(1)
    1821829
    183183
    184 # Invalid pages raise InvalidPage.
     184# Invalid pages raise EmptyPage.
    185185>>> paginator.get_page(-1)
    186186Traceback (most recent call last):
    187187...
    188 InvalidPage: ...
     188EmptyPage: ...
    189189>>> paginator.get_page(2)
    190190Traceback (most recent call last):
    191191...
    192 InvalidPage: ...
     192EmptyPage: ...
    193193
    194194# Empty paginators with allow_empty_first_page=True.
    195195>>> paginator = ObjectPaginator(Article.objects.filter(id=0), 5)
Back to Top