          self.assertNotEqual(response.data['next'], None)
          self.assertNotEqual(response.data['previous'], None)
  
          request = factory.get(response.data['next'])
          response = self.view(request).render()
          self.assertEqual(response.status_code, status.HTTP_200_OK)
          self.assertEqual(response.data['count'], 26)
          self.assertEqual(response.data['results'], self.data[20:])
          self.assertEqual(response.data['next'], None)
          self.assertNotEqual(response.data['previous'], None)
 
</s> remove         response = self.view(request).render()
 </s> add         with self.assertNumQueries(2):
            response = self.view(request).render() </s> remove         response = self.view(request).render()
 </s> add         # Note: Database queries are a `SELECT COUNT`, and `SELECT <fields>`
        with self.assertNumQueries(2):
            response = self.view(request).render() </s> remove     else:
        len_args = len(args) if inspect.isfunction(obj) else len(args) - 1
        len_defaults = len(defaults) if defaults else 0
        return len_args <= len_defaults
 </s> add     args, _, _, defaults = inspect.getargspec(obj)
    len_args = len(args) if function else len(args) - 1
    len_defaults = len(defaults) if defaults else 0
    return len_args <= len_defaults </s> remove     try:
        args, _, _, defaults = inspect.getargspec(obj)
    except TypeError:
 </s> add     function = inspect.isfunction(obj)
    method = inspect.ismethod(obj)

    if not (function or method):
        with self.assertNumQueries(2):
            response = self.view(request).render()
          self.assertNotEqual(response.data['next'], None)
          self.assertNotEqual(response.data['previous'], None)
  
          request = factory.get(response.data['next'])
        with self.assertNumQueries(2):
            response = self.view(request).render()
          self.assertEqual(response.status_code, status.HTTP_200_OK)
          self.assertEqual(response.data['count'], 26)
          self.assertEqual(response.data['results'], self.data[20:])
          self.assertEqual(response.data['next'], None)
          self.assertNotEqual(response.data['previous'], None)
keep keep keep keep replace keep keep keep keep keep
 Fix duplicated database queries for paginated lists.

Closes #713. 
rest_framework/tests/pagination.py