Refs #23919, #27778 -- Removed obsolete mentions of unicode.

This commit is contained in:
Vytis Banaitis 2017-01-20 23:04:05 +02:00 committed by Tim Graham
parent 888c1e9bfe
commit d1bab24e01
63 changed files with 201 additions and 251 deletions

View file

@ -160,8 +160,7 @@ class FilterSyntaxTests(SimpleTestCase):
@setup({'filter-syntax18': r'{{ var }}'})
def test_filter_syntax18(self):
"""
Make sure that any unicode strings are converted to bytestrings
in the final output.
Strings are converted to bytestrings in the final output.
"""
output = self.engine.render_to_string('filter-syntax18', {'var': UTF8Class()})
self.assertEqual(output, '\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111')

View file

@ -158,7 +158,7 @@ class FileSystemLoaderTests(SimpleTestCase):
with self.source_checker(['/dir1', '/dir2']) as check_sources:
# UTF-8 bytestrings are permitted.
check_sources(b'\xc3\x85ngstr\xc3\xb6m', ['/dir1/Ångström', '/dir2/Ångström'])
# Unicode strings are permitted.
# Strings are permitted.
check_sources('Ångström', ['/dir1/Ångström', '/dir2/Ångström'])
def test_utf8_bytestring(self):

View file

@ -7,7 +7,7 @@ from django.utils.safestring import SafeData
class UnicodeTests(TestCase):
def test_template(self):
# Templates can be created from unicode strings.
# Templates can be created from strings.
engine = Engine()
t1 = engine.from_string('ŠĐĆŽćžšđ {{ var }}')
# Templates can also be created from bytestrings. These are assumed to
@ -17,14 +17,14 @@ class UnicodeTests(TestCase):
with self.assertRaises(TemplateEncodingError):
engine.from_string(b'\x80\xc5\xc0')
# Contexts can be constructed from unicode or UTF-8 bytestrings.
# Contexts can be constructed from strings or UTF-8 bytestrings.
Context({b"var": b"foo"})
Context({"var": b"foo"})
c3 = Context({b"var": "Đđ"})
Context({"var": b"\xc4\x90\xc4\x91"})
# Since both templates and all four contexts represent the same thing,
# they all render the same (and are returned as unicode objects and
# they all render the same (and are returned as strings and
# "safe" objects as well, for auto-escaping purposes).
self.assertEqual(t1.render(c3), t2.render(c3))
self.assertIsInstance(t1.render(c3), str)

View file

@ -169,7 +169,7 @@ class UTF8Class:
return 'ŠĐĆŽćžšđ'
# These two classes are used to test auto-escaping of unicode output.
# These two classes are used to test auto-escaping of string output.
class UnsafeClass:
def __str__(self):
return 'you & me'