Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[py3] Fixed paginator tests.

  • Loading branch information...
commit 0ab570217a07726426fd6728c472093a87df691f 1 parent c158489
@apollo13 apollo13 authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 tests/modeltests/pagination/tests.py
View
12 tests/modeltests/pagination/tests.py
@@ -28,7 +28,7 @@ def test_paginator(self):
paginator = Paginator(Article.objects.all(), 5)
self.assertEqual(9, paginator.count)
self.assertEqual(2, paginator.num_pages)
- self.assertEqual([1, 2], paginator.page_range)
+ self.assertEqual([1, 2], list(paginator.page_range))
def test_first_page(self):
paginator = Paginator(Article.objects.all(), 5)
@@ -78,13 +78,13 @@ def test_empty_page(self):
paginator = Paginator(Article.objects.filter(id=0), 5, allow_empty_first_page=True)
self.assertEqual(0, paginator.count)
self.assertEqual(1, paginator.num_pages)
- self.assertEqual([1], paginator.page_range)
+ self.assertEqual([1], list(paginator.page_range))
# Empty paginators with allow_empty_first_page=False.
paginator = Paginator(Article.objects.filter(id=0), 5, allow_empty_first_page=False)
self.assertEqual(0, paginator.count)
self.assertEqual(0, paginator.num_pages)
- self.assertEqual([], paginator.page_range)
+ self.assertEqual([], list(paginator.page_range))
def test_invalid_page(self):
paginator = Paginator(Article.objects.all(), 5)
@@ -108,7 +108,7 @@ def test_paginate_list(self):
paginator = Paginator([1, 2, 3, 4, 5, 6, 7, 8, 9], 3)
self.assertEqual(9, paginator.count)
self.assertEqual(3, paginator.num_pages)
- self.assertEqual([1, 2, 3], paginator.page_range)
+ self.assertEqual([1, 2, 3], list(paginator.page_range))
p = paginator.page(2)
self.assertEqual("<Page 2 of 3>", six.text_type(p))
self.assertEqual([4, 5, 6], p.object_list)
@@ -125,10 +125,10 @@ def test_paginate_misc_classes(self):
paginator = Paginator(CountContainer(), 10)
self.assertEqual(42, paginator.count)
self.assertEqual(5, paginator.num_pages)
- self.assertEqual([1, 2, 3, 4, 5], paginator.page_range)
+ self.assertEqual([1, 2, 3, 4, 5], list(paginator.page_range))
# Paginator can be passed other objects that implement __len__.
paginator = Paginator(LenContainer(), 10)
self.assertEqual(42, paginator.count)
self.assertEqual(5, paginator.num_pages)
- self.assertEqual([1, 2, 3, 4, 5], paginator.page_range)
+ self.assertEqual([1, 2, 3, 4, 5], list(paginator.page_range))
Please sign in to comment.
Something went wrong with that request. Please try again.