          class ExamplePagination(pagination.CursorPagination):
              page_size = 5
              ordering = 'created'
  
          self.pagination = ExamplePagination()
          self.queryset = MockQuerySet([
 
</s> remove         if self.page_size is None:
 </s> add         self.page_size = self.get_page_size(request)
        if not self.page_size: </s> remove     page_size = api_settings.PAGE_SIZE
 </s> add  </s> remove class CursorPagination(BasePagination):
 </s> add class CursorPagination(BasePageSizePagination):
            page_size_query_param = 'page_size'
            max_page_size = 20
          class ExamplePagination(pagination.CursorPagination):
              page_size = 5
            page_size_query_param = 'page_size'
            max_page_size = 20
              ordering = 'created'
  
          self.pagination = ExamplePagination()
          self.queryset = MockQuerySet([
keep add keep keep keep keep
 use PageSizePaginationMixin for CursorPagination
tests for custom page_size in CursorPagination 
tests/test_pagination.py