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
1 changed files with 6 additions and 0 deletions

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)