Пример #1
0
 def test_large_end_result_set(self):
     paginator = Paginator(range(133), 12)
     self.assertEqual(paginator.page_numbers(), [9, 10, 11, 12, 13])
     self.assertEqual(paginator.page_numbers_left(), [9, 10, 11])
     self.assertEqual(paginator.page_numbers_right(), [13])
     self.assertFalse(paginator.show_end())
     self.assertFalse(paginator.needs_end_ellipsis())
Пример #2
0
 def test_large_end_result_set(self):
     paginator = Paginator(range(133), 12)
     self.assertEqual(paginator.page_numbers(), [9, 10, 11, 12, 13])
     self.assertEqual(paginator.page_numbers_left(), [9, 10, 11])
     self.assertEqual(paginator.page_numbers_right(), [13])
     self.assertFalse(paginator.show_end())
     self.assertFalse(paginator.needs_end_ellipsis())
Пример #3
0
 def test_small_result_set(self):
     paginator = Paginator(range(39), 0)
     self.assertFalse(paginator.show_start())
     self.assertFalse(paginator.needs_start_ellipsis())
     self.assertFalse(paginator.show_end())
     self.assertFalse(paginator.needs_end_ellipsis())
     self.assertEqual(paginator.page_numbers_left(), [])
     self.assertEqual(paginator.page_numbers_right(), [1, 2, 3])
Пример #4
0
 def test_small_result_set(self):
     paginator = Paginator(range(39), 0)
     self.assertFalse(paginator.show_start())
     self.assertFalse(paginator.needs_start_ellipsis())
     self.assertFalse(paginator.show_end())
     self.assertFalse(paginator.needs_end_ellipsis())
     self.assertEqual(paginator.page_numbers_left(), [])
     self.assertEqual(paginator.page_numbers_right(), [1, 2, 3])
Пример #5
0
 def test_show_end_not_ellipsis(self):
     paginator = Paginator(range(100), 6)
     self.assertTrue(paginator.show_start())
     self.assertTrue(paginator.needs_start_ellipsis())
     self.assertEqual(paginator.page_numbers(), [4, 5, 6, 7, 8])
     self.assertEqual(paginator.page_numbers_left(), [4, 5])
     self.assertEqual(paginator.page_numbers_right(), [7, 8])
     self.assertTrue(paginator.show_end())
     self.assertFalse(paginator.needs_end_ellipsis())
Пример #6
0
 def test_show_end_not_ellipsis(self):
     paginator = Paginator(range(100), 6)
     self.assertTrue(paginator.show_start())
     self.assertTrue(paginator.needs_start_ellipsis())
     self.assertEqual(paginator.page_numbers(), [4, 5, 6, 7, 8])
     self.assertEqual(paginator.page_numbers_left(), [4, 5])
     self.assertEqual(paginator.page_numbers_right(), [7, 8])
     self.assertTrue(paginator.show_end())
     self.assertFalse(paginator.needs_end_ellipsis())