예제 #1
0
 def test_no_other_pages(self):
     short_paginator = Paginator(object_list=[1, 2], per_page=10)
     page = short_paginator.page(1)
     assert page.start_index() == 1
     assert page.end_index() == 10
     assert page.has_previous() is False
     assert page.has_next() is False
     assert page.has_other_pages() is False
예제 #2
0
 def test_short_pages(self):
     paginator = Paginator(object_list=range(1, 15), per_page=3)
     page = paginator.page(2)
     assert page.start_index() == 4
     assert page.end_index() == 6
     assert page.has_next() is True
     assert page.has_other_pages() is True
     assert page.next_page_number() == 3
     assert page.object_list == [4, 5, 6]