      def test_parse_error_renderers_browsable_api(self):
          """Invalid data should still render the browsable API correctly."""
          resp = self.client.post('/parseerror', data='foobar', content_type='application/json', HTTP_ACCEPT='text/html')
          self.assertEqual(resp['Content-Type'], 'text/html; charset=utf-8')
          self.assertContains(resp.content, 'Mock GET View')
          self.assertEqual(resp.status_code, status.HTTP_400_)
  
  _flat_repr = '{"foo": ["bar", "baz"]}'
  _indented_repr = '{\n  "foo": [\n    "bar",\n    "baz"\n  ]\n}'
  
  
 
</s> remove             data = request.DATA
            files = request.FILES
 </s> add             try:
                data = request.DATA
                files = request.FILES
            except ParseError:
                data = None
                files = None         </s> remove     url(r'^parseerror$', MockGETView.as_view(renderer_classes=[JSONRenderer, BrowsableAPIRenderer])),
 </s> add     url(r'^parseerror$', MockPOSTView.as_view(renderer_classes=[JSONRenderer, BrowsableAPIRenderer])),
        self.assertIn('Mock Post', resp.content)
        self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST)
      def test_parse_error_renderers_browsable_api(self):
          """Invalid data should still render the browsable API correctly."""
          resp = self.client.post('/parseerror', data='foobar', content_type='application/json', HTTP_ACCEPT='text/html')
          self.assertEqual(resp['Content-Type'], 'text/html; charset=utf-8')
        self.assertIn('Mock Post', resp.content)
        self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST)
        self.assertIn('Mock Post', resp.content)
        self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST)
  
  _flat_repr = '{"foo": ["bar", "baz"]}'
  _indented_repr = '{\n  "foo": [\n    "bar",\n    "baz"\n  ]\n}'
  
  
keep keep keep keep replace replace keep keep keep keep keep
 Catch and mask ParseErrors that occur during rendering of the BrowsableAPI. 
rest_framework/tests/test_renderers.py