mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Refs #23919 -- Removed default 'utf-8' argument for str.encode()/decode().
This commit is contained in:
parent
21f13ff5b3
commit
500532c95d
32 changed files with 61 additions and 65 deletions
|
@ -317,7 +317,7 @@ class HttpResponseTests(unittest.TestCase):
|
|||
with self.assertRaises(UnicodeError):
|
||||
r.__setitem__('føø', 'bar')
|
||||
with self.assertRaises(UnicodeError):
|
||||
r.__setitem__('føø'.encode('utf-8'), 'bar')
|
||||
r.__setitem__('føø'.encode(), 'bar')
|
||||
|
||||
def test_long_line(self):
|
||||
# Bug #20889: long lines trigger newlines to be added to headers
|
||||
|
@ -371,7 +371,7 @@ class HttpResponseTests(unittest.TestCase):
|
|||
# test odd inputs
|
||||
r = HttpResponse()
|
||||
r.content = ['1', '2', 3, '\u079e']
|
||||
# '\xde\x9e' == unichr(1950).encode('utf-8')
|
||||
# '\xde\x9e' == unichr(1950).encode()
|
||||
self.assertEqual(r.content, b'123\xde\x9e')
|
||||
|
||||
# .content can safely be accessed multiple times.
|
||||
|
@ -573,7 +573,7 @@ class StreamingHttpResponseTests(SimpleTestCase):
|
|||
# iterating over strings still yields bytestring chunks.
|
||||
r.streaming_content = iter(['hello', 'café'])
|
||||
chunks = list(r)
|
||||
# '\xc3\xa9' == unichr(233).encode('utf-8')
|
||||
# '\xc3\xa9' == unichr(233).encode()
|
||||
self.assertEqual(chunks, [b'hello', b'caf\xc3\xa9'])
|
||||
for chunk in chunks:
|
||||
self.assertIsInstance(chunk, bytes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue