Remove unnecessary bytes() calls (#6626)

This commit is contained in:
Jon Dufresne 2019-05-30 15:05:27 -07:00 committed by Ryan P Kilby
parent 6bd25c09a6
commit b37aa284eb
3 changed files with 3 additions and 3 deletions

View File

@ -88,7 +88,7 @@ class JSONRenderer(BaseRenderer):
Render `data` into JSON, returning a bytestring.
"""
if data is None:
return bytes()
return b''
renderer_context = renderer_context or {}
indent = self.get_indent(accepted_media_type, renderer_context)

View File

@ -73,7 +73,7 @@ class Response(SimpleTemplateResponse):
'renderer returned unicode, and did not specify '
'a charset value.'
)
return bytes(ret.encode(charset))
return ret.encode(charset)
if not ret:
del self['Content-Type']

View File

@ -185,7 +185,7 @@ class APIRequestFactory(DjangoRequestFactory):
# Coerce text to bytes if required.
if isinstance(ret, str):
ret = bytes(ret.encode(renderer.charset))
ret = ret.encode(renderer.charset)
return ret, content_type