Skip to content

Commit

Permalink
[py3k] Fixed pagination_regress tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Gaynor committed Aug 16, 2012
1 parent d69bd23 commit 37a894b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/regressiontests/pagination_regress/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ def check_paginator(self, params, output):
paginator = Paginator(*params)
self.check_attribute('count', paginator, count, params)
self.check_attribute('num_pages', paginator, num_pages, params)
self.check_attribute('page_range', paginator, page_range, params)
self.check_attribute('page_range', paginator, page_range, params, coerce=list)

def check_attribute(self, name, paginator, expected, params):
def check_attribute(self, name, paginator, expected, params, coerce=None):
"""
Helper method that checks a single attribute and gives a nice error
message upon test failure.
"""
got = getattr(paginator, name)
if coerce is not None:
got = coerce(got)
self.assertEqual(expected, got,
"For '%s', expected %s but got %s. Paginator parameters were: %s"
% (name, expected, got, params))
Expand Down

0 comments on commit 37a894b

Please sign in to comment.