          else:
              self.cursor = decode_cursor(encoded)
              (offset, reverse, current_position) = self.cursor
  
          # Cursor pagination always enforces an ordering.
          if reverse:
              queryset = queryset.order_by('-' + self.ordering)
 
</s> remove             # TODO: Invalid cursors should 404
 </s> add  </s> remove         compare = self.next_position
 </s> add         if self.cursor and self.cursor.reverse and self.cursor.offset != 0:
            # If we're reversing direction and we have an offset cursor
            # then we cannot use the first position we find as a marker.
            compare = self._get_position_from_instance(self.page[-1], self.ordering)
        else:
            compare = self.next_position </s> remove         compare = self.previous_position
 </s> add         if self.cursor and not self.cursor.reverse and self.cursor.offset != 0:
            # If we're reversing direction and we have an offset cursor
            # then we cannot use the first position we find as a marker.
            compare = self._get_position_from_instance(self.page[0], self.ordering)
        else:
            compare = self.previous_position </s> remove             self.page = reversed(self.page)
 </s> add             self.page = list(reversed(self.page)) </s> remove         request = Request(factory.get(previous_url))
        queryset = self.paginate_queryset(request)
        assert [item.created for item in queryset] == [6, 7, 8, 9, 10]
 </s> add         if next_url is not None:
            request = Request(factory.get(next_url))
            queryset = self.pagination.paginate_queryset(self.queryset, request)
            next = [item.created for item in queryset]
        else:
            next = None
            if self.cursor is None:
                raise NotFound(self.invalid_cursor_message)
          else:
              self.cursor = decode_cursor(encoded)
            if self.cursor is None:
                raise NotFound(self.invalid_cursor_message)
              (offset, reverse, current_position) = self.cursor
  
          # Cursor pagination always enforces an ordering.
          if reverse:
              queryset = queryset.order_by('-' + self.ordering)
keep add keep keep keep keep keep
 Tidy up cursor tests and make more comprehensive 
rest_framework/pagination.py