  from django.test import TestCase
  from django.test.client import RequestFactory
  from django.utils import simplejson as json
  from rest_framework import generics, serializers, status
  from rest_framework.tests.models import BasicModel, Comment, SlugBasedModel
  
  
 
</s> remove from django.test.client import RequestFactory
 </s> add # from django.test.client import RequestFactory </s> remove factory = RequestFactory()
 </s> add factory = DRFRequestFactory() </s> remove     # def test_patch_instance_view(self):
    #     """
    #     PATCH requests to RetrieveUpdateDestroyAPIView should update an object.
    #     """
    #     content = {'text': 'foobar'}
    #     request = factory.patch('/1', json.dumps(content),
    #                           content_type='application/json')
    #     response = self.view(request, pk=1).render()
    #     self.assertEquals(response.status_code, status.HTTP_200_OK)
    #     self.assertEquals(response.data, {'id': 1, 'text': 'foobar'})
    #     updated = self.objects.get(id=1)
    #     self.assertEquals(updated.text, 'foobar')
 </s> add     def test_patch_instance_view(self):
        """
        PATCH requests to RetrieveUpdateDestroyAPIView should update an object.
        """
        content = {'text': 'foobar'}
        request = factory.patch('/1', json.dumps(content),
                              content_type='application/json')

        response = self.view(request, pk=1).render()
        self.assertEquals(response.status_code, status.HTTP_200_OK)
        self.assertEquals(response.data, {'id': 1, 'text': 'foobar'})
        updated = self.objects.get(id=1)
        self.assertEquals(updated.text, 'foobar')
  from django.test import TestCase

  from django.utils import simplejson as json
  from rest_framework import generics, serializers, status
  from rest_framework.tests.models import BasicModel, Comment, SlugBasedModel
  
  
keep replace keep keep keep keep keep
 Adjust PATCH test cases to use the new DRFRequestFactory 
rest_framework/tests/generics.py