mirror of https://github.com/django/django.git
Refs #29389 -- Added Paginator test for float page number.
This commit is contained in:
parent
3574a6d32f
commit
2134e7d439
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue