Refs #27795 -- Removed force_text() usage in django/test/testcases.py.
This commit is contained in:
parent
1f3852b708
commit
919d59811f
|
@ -34,7 +34,6 @@ from django.test.utils import (
|
||||||
override_settings,
|
override_settings,
|
||||||
)
|
)
|
||||||
from django.utils.decorators import classproperty
|
from django.utils.decorators import classproperty
|
||||||
from django.utils.encoding import force_text
|
|
||||||
from django.views.static import serve
|
from django.views.static import serve
|
||||||
|
|
||||||
__all__ = ('TestCase', 'TransactionTestCase',
|
__all__ = ('TestCase', 'TransactionTestCase',
|
||||||
|
@ -339,7 +338,7 @@ class SimpleTestCase(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
content = response.content
|
content = response.content
|
||||||
if not isinstance(text, bytes) or html:
|
if not isinstance(text, bytes) or html:
|
||||||
text = force_text(text, encoding=response.charset)
|
text = str(text)
|
||||||
content = content.decode(response.charset)
|
content = content.decode(response.charset)
|
||||||
text_repr = "'%s'" % text
|
text_repr = "'%s'" % text
|
||||||
else:
|
else:
|
||||||
|
@ -650,7 +649,7 @@ class SimpleTestCase(unittest.TestCase):
|
||||||
optional.clean(input)
|
optional.clean(input)
|
||||||
self.assertEqual(context_manager.exception.messages, errors)
|
self.assertEqual(context_manager.exception.messages, errors)
|
||||||
# test required inputs
|
# test required inputs
|
||||||
error_required = [force_text(required.error_messages['required'])]
|
error_required = [required.error_messages['required']]
|
||||||
for e in required.empty_values:
|
for e in required.empty_values:
|
||||||
with self.assertRaises(ValidationError) as context_manager:
|
with self.assertRaises(ValidationError) as context_manager:
|
||||||
required.clean(e)
|
required.clean(e)
|
||||||
|
|
Loading…
Reference in New Issue