sangdongvan / django-pagination

Automatically exported from code.google.com/p/django-pagination due to issue syntax errors when running python3
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Setting PAGINATION_DEFAULT_WINDOW to something other than 4 causes unit tests to fail #75

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If I set PAGINATION_DEFAULT_WINDOW to 2 in my settings.py, the pagination unit 
tests will fail when I run my project unit tests. It would be best if the 
pagination tests temporarily set this variable to an expected value before they 
run, and set it back to what it was when they are done. This way, the 
pagination tests will pass no matter what I have the DEFAULT_WINDOW set to. 
Thanks!

======================================================================
FAIL: Doctest: pagination.tests
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rbarlow/.virtualenvs/titles-db/lib/python2.6/site-packages/django/test/_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for pagination.tests
  File "/home/rbarlow/.virtualenvs/titles-db/lib/python2.6/site-packages/pagination/tests.py", line 0, in tests

----------------------------------------------------------------------
File 
"/home/rbarlow/.virtualenvs/titles-db/lib/python2.6/site-packages/pagination/tes
ts.py", line 8, in pagination.tests
Failed example:
    pg['pages']
Expected:
    [1, 2, 3, 4, 5, 6, 7, 8]
Got:
    [1, 2, None, 7, 8]
----------------------------------------------------------------------
File 
"/home/rbarlow/.virtualenvs/titles-db/lib/python2.6/site-packages/pagination/tes
ts.py", line 17, in pagination.tests
Failed example:
    pg['pages']
Expected:
    [1, 2, 3, 4, 5, 6, 7, 8]
Got:
    [1, 2, None, 6, 7, 8]
----------------------------------------------------------------------
File 
"/home/rbarlow/.virtualenvs/titles-db/lib/python2.6/site-packages/pagination/tes
ts.py", line 25, in pagination.tests
Failed example:
    paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
Expected:
    [1, 2, 3, 4, 5, 6, 7, 8, 9]
Got:
    [1, 2, None, 8, 9]
----------------------------------------------------------------------
File 
"/home/rbarlow/.virtualenvs/titles-db/lib/python2.6/site-packages/pagination/tes
ts.py", line 29, in pagination.tests
Failed example:
    paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
Expected:
    [1, 2, 3, 4, None, 7, 8, 9, 10]
Got:
    [1, 2, None, 9, 10]
----------------------------------------------------------------------
File 
"/home/rbarlow/.virtualenvs/titles-db/lib/python2.6/site-packages/pagination/tes
ts.py", line 33, in pagination.tests
Failed example:
    paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
Expected:
    [1, 2, 3, 4, None, 8, 9, 10, 11]
Got:
    [1, 2, None, 10, 11]
----------------------------------------------------------------------
File 
"/home/rbarlow/.virtualenvs/titles-db/lib/python2.6/site-packages/pagination/tes
ts.py", line 43, in pagination.tests
Failed example:
    pg['pages']
Expected:
    [1, 2, 3, 4, None, 7, 8, 9, 10]
Got:
    [1, 2, None, 9, 10]
----------------------------------------------------------------------
File 
"/home/rbarlow/.virtualenvs/titles-db/lib/python2.6/site-packages/pagination/tes
ts.py", line 52, in pagination.tests
Failed example:
    pg['pages']
Expected:
    [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Got:
    [1, 2, None, 8, 9, 10]

Original issue reported on code.google.com by ra...@electronsweatshop.com on 6 Oct 2010 at 3:57