mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #14218 -- Added Paginator.__iter__().
This commit is contained in:
committed by
Carlton Gibson
parent
84322a29ce
commit
17595407ca
@@ -297,6 +297,13 @@ class PaginationTests(SimpleTestCase):
|
||||
with self.assertRaises(EmptyPage):
|
||||
paginator.get_page(1)
|
||||
|
||||
def test_paginator_iteration(self):
|
||||
paginator = Paginator([1, 2, 3], 2)
|
||||
page_iterator = iter(paginator)
|
||||
for page, expected in enumerate(([1, 2], [3]), start=1):
|
||||
with self.subTest(page=page):
|
||||
self.assertEqual(expected, list(next(page_iterator)))
|
||||
|
||||
|
||||
class ModelPaginationTests(TestCase):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user