X-Git-Url: https://git.mdrn.pl/django-pagination.git/blobdiff_plain/4f04eedff0178a927430194cf4c2c298cafb7a18..8eb85c98dda807cd7ebd9c602a244140dea97249:/pagination/tests.py?ds=sidebyside diff --git a/pagination/tests.py b/pagination/tests.py index c0a4a6c..fadb870 100644 --- a/pagination/tests.py +++ b/pagination/tests.py @@ -62,6 +62,7 @@ u'[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]' # Testing InfinitePaginator >>> from paginator import InfinitePaginator + >>> InfinitePaginator >>> p = InfinitePaginator(range(20), 2, link_template='/bacon/page/%d') @@ -86,4 +87,45 @@ False '/bacon/page/4' >>> p3.previous_link() '/bacon/page/2' + +# Testing FinitePaginator + +>>> from paginator import FinitePaginator + +>>> FinitePaginator + +>>> p = FinitePaginator(range(20), 2, offset=10, link_template='/bacon/page/%d') +>>> p.validate_number(2) +2 +>>> p.orphans +0 +>>> p3 = p.page(3) +>>> p3 + +>>> p3.start_index() +10 +>>> p3.end_index() +6 +>>> p3.has_next() +True +>>> p3.has_previous() +True +>>> p3.next_link() +'/bacon/page/4' +>>> p3.previous_link() +'/bacon/page/2' + +>>> p = FinitePaginator(range(20), 20, offset=10, link_template='/bacon/page/%d') +>>> p2 = p.page(2) +>>> p2 + +>>> p2.has_next() +False +>>> p3.has_previous() +True +>>> p2.next_link() + +>>> p2.previous_link() +'/bacon/page/1' + """ \ No newline at end of file