          content = {'text': 'foobar'}
          # pk fields can not be created on demand, only the database can set the pk for a new object
          request = factory.put('/5', json.dumps(content),
                                content_type='application/json')
          response = self.view(request, pk=5).render()
          self.assertEqual(response.status_code, status.HTTP_201_CREATED)
          new_obj = self.objects.get(pk=5)
          self.assertEqual(new_obj.text, 'foobar')
  
      def test_put_as_create_on_slug_based_url(self):
 
</s> remove         response = self.slug_based_view(request, slug='test_slug').render()
 </s> add         with self.assertNumQueries(2):
            response = self.slug_based_view(request, slug='test_slug').render() </s> remove         response = self.view(request).render()
 </s> add         with self.assertNumQueries(0):
            response = self.view(request).render() </s> remove         response = self.view(request, pk=1).render()
 </s> add         with self.assertNumQueries(4):
            response = self.view(request, pk=1).render() </s> remove         response = self.view(request, pk=1).render()
 </s> add         with self.assertNumQueries(3):
            response = self.view(request, pk=1).render() </s> remove         response = self.view(request).render()
 </s> add         with self.assertNumQueries(0):
            response = self.view(request).render()
        with self.assertNumQueries(4):
            response = self.view(request, pk=5).render()
          content = {'text': 'foobar'}
          # pk fields can not be created on demand, only the database can set the pk for a new object
          request = factory.put('/5', json.dumps(content),
                                content_type='application/json')
        with self.assertNumQueries(4):
            response = self.view(request, pk=5).render()
          self.assertEqual(response.status_code, status.HTTP_201_CREATED)
          new_obj = self.objects.get(pk=5)
          self.assertEqual(new_obj.text, 'foobar')
  
      def test_put_as_create_on_slug_based_url(self):
keep keep keep keep replace keep keep keep keep keep
 Add some simple numQueries tests. 
rest_framework/tests/generics.py