Helper method that instantiates a Paginator object from the passed params and then checks that the start and end indexes of the passed page_num match those given as a 2-tuple in indexes.
(self, params, page_num, indexes)
| 288 | await AsyncPaginator(TypeErrorContainer(), 10).acount() |
| 289 | |
| 290 | def check_indexes(self, params, page_num, indexes): |
| 291 | """ |
| 292 | Helper method that instantiates a Paginator object from the passed |
| 293 | params and then checks that the start and end indexes of the passed |
| 294 | page_num match those given as a 2-tuple in indexes. |
| 295 | """ |
| 296 | paginator = Paginator(*params) |
| 297 | if page_num == "first": |
| 298 | page_num = 1 |
| 299 | elif page_num == "last": |
| 300 | page_num = paginator.num_pages |
| 301 | page = paginator.page(page_num) |
| 302 | start, end = indexes |
| 303 | msg = "For %s of page %s, expected %s but got %s. Paginator parameters were: %s" |
| 304 | self.assertEqual( |
| 305 | start, |
| 306 | page.start_index(), |
| 307 | msg % ("start index", page_num, start, page.start_index(), params), |
| 308 | ) |
| 309 | self.assertEqual( |
| 310 | end, |
| 311 | page.end_index(), |
| 312 | msg % ("end index", page_num, end, page.end_index(), params), |
| 313 | ) |
| 314 | |
| 315 | async def check_indexes_async(self, params, page_num, indexes): |
| 316 | """See check_indexes.""" |
no test coverage detected