  import coreapi
  from rest_framework import permissions, serializers, status
  from rest_framework.renderers import (
      AdminRenderer, BaseRenderer, BrowsableAPIRenderer, DocumentationRenderer,
      HTMLFormRenderer, JSONRenderer, StaticHTMLRenderer
  )
  from rest_framework.request import Request
  from rest_framework.response import Response
  from rest_framework.settings import api_settings
  from rest_framework.test import APIRequestFactory
 
</s> remove         schema = base64.b64encode(codec.encode(data))
 </s> add         schema = base64.b64encode(codec.encode(data)).decode('ascii')
    HTMLFormRenderer, JSONRenderer, SchemaJSRenderer, StaticHTMLRenderer
  import coreapi
  from rest_framework import permissions, serializers, status
  from rest_framework.renderers import (
      AdminRenderer, BaseRenderer, BrowsableAPIRenderer, DocumentationRenderer,
    HTMLFormRenderer, JSONRenderer, SchemaJSRenderer, StaticHTMLRenderer
  )
  from rest_framework.request import Request
  from rest_framework.response import Response
  from rest_framework.settings import api_settings
  from rest_framework.test import APIRequestFactory
keep keep keep keep replace keep keep keep keep keep
 SchemaJSRenderer renders invalid Javascript (#5607)

* SchemaJSRenderer renders invalid Javascript

Under Py3 the base64.b64encode() method returns a binary object, which gets rendered as `b'...'` in schema.js. This results in the output becoming:

    var coreJSON = window.atob('b'eyJf...'');

which is invalid Javascript. Because base64 only uses ASCII characters it is safe to decode('ascii') it. Under Py2 this will result in a unicode object, which is fine. Under Py3 it results in a string, which is also fine. This solves the problem and results in a working schema.js output.

* Add regression test for #5608

* Add regression test for #5608

* Apparently the linter on Travis wants the imports in a different order than on my box... 
tests/test_renderers.py