diff options
| author | Tanner Stirrat <tstirrat@gmail.com> | 2019-09-20 15:04:34 -0600 |
|---|---|---|
| committer | Carlton Gibson <carlton@noumenal.es> | 2019-10-02 09:49:31 +0200 |
| commit | 17595407ca456dc2f0cf3ddb5878ff75615c94ff (patch) | |
| tree | 89de288eb3def5f0457ed2dcac57cda3451143ba /tests/pagination | |
| parent | 84322a29ce9b0940335f8ab3d60e55192bef1e50 (diff) | |
Fixed #14218 -- Added Paginator.__iter__().
Diffstat (limited to 'tests/pagination')
| -rw-r--r-- | tests/pagination/tests.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py index ef6e355e8d..f82d333ae7 100644 --- a/tests/pagination/tests.py +++ b/tests/pagination/tests.py @@ -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): """ |
