1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #29389 -- Added Paginator test for float page number.

This commit is contained in:
Nicolas Noé 2018-05-09 09:16:28 -04:00 committed by Tim Graham
parent 3574a6d32f
commit 2134e7d439

View File

@ -120,6 +120,12 @@ class PaginationTests(unittest.TestCase):
paginator.validate_number(None)
with self.assertRaises(PageNotAnInteger):
paginator.validate_number('x')
def test_float_integer_page(self):
paginator = Paginator([1, 2, 3], 2)
self.assertEqual(paginator.validate_number(1.0), 1)
def test_no_content_allow_empty_first_page(self):
# With no content and allow_empty_first_page=True, 1 is a valid page number
paginator = Paginator([], 2)
self.assertEqual(paginator.validate_number(1), 1)