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])
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])
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())
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())
def test_show_start(self): paginator = Paginator(range(100), 3) self.assertTrue(paginator.show_start()) self.assertFalse(paginator.needs_start_ellipsis()) self.assertEqual(paginator.page_numbers_left(), [1, 2]) self.assertEqual(paginator.page_numbers_right(), [4, 5])
def test_show_start(self): paginator = Paginator(range(100), 3) self.assertTrue(paginator.show_start()) self.assertFalse(paginator.needs_start_ellipsis()) self.assertEqual(paginator.page_numbers_left(), [1, 2]) self.assertEqual(paginator.page_numbers_right(), [4, 5])