mirror of
https://github.com/django/django.git
synced 2025-10-29 16:46:11 +00:00
Fixed #18561 -- Made HttpResponse.tell() support non-ascii chars
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import copy
|
||||
@@ -298,6 +299,17 @@ class HttpResponseTests(unittest.TestCase):
|
||||
self.assertRaises(UnicodeEncodeError,
|
||||
getattr, r, 'content')
|
||||
|
||||
def test_file_interface(self):
|
||||
r = HttpResponse()
|
||||
r.write(b"hello")
|
||||
self.assertEqual(r.tell(), 5)
|
||||
r.write("привет")
|
||||
self.assertEqual(r.tell(), 17)
|
||||
|
||||
r = HttpResponse(['abc'])
|
||||
self.assertRaises(Exception, r.write, 'def')
|
||||
|
||||
|
||||
class CookieTests(unittest.TestCase):
|
||||
def test_encode(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user