Example #1
0
 def test_invalid_page(self):
     example_list = ['1', '2', '3']
     with self.assertRaises(InvalidPage):
         paginator = FastPaginator(
             example_list, 2,
             cache_key="invalid_page_test_key")
         paginator.page(3)
Example #2
0
 def test_page_empty(self):
     example_list = []
     with self.assertRaises(EmptyPage):
         paginator = FastPaginator(
             example_list, 2,
             cache_key="empty_page_test_key")
         paginator.page(-1)
Example #3
0
 def test_page_not_an_integer(self):
     example_list = ['1', '2', '3']
     with self.assertRaises(PageNotAnInteger):
         paginator = FastPaginator(
             example_list, 2,
             cache_key="not_integer_test_key")
         paginator.page(None)
Example #4
0
 def test_key_not_found(self):
     example_list = []
     with self.assertRaises(ValueError):
         paginator = FastPaginator(
             example_list, 2)