mirror of
https://github.com/django/django.git
synced 2025-09-26 20:19:16 +00:00
[py3] Replaced unicode/str by six.text_type/bytes.
This commit is contained in:
parent
3cb2457f46
commit
bdca5ea345
96 changed files with 376 additions and 294 deletions
|
@ -4,6 +4,7 @@ import copy
|
|||
import pickle
|
||||
|
||||
from django.test.utils import str_prefix
|
||||
from django.utils import six
|
||||
from django.utils.unittest import TestCase
|
||||
from django.utils.functional import SimpleLazyObject, empty
|
||||
|
||||
|
@ -22,7 +23,7 @@ class _ComplexObject(object):
|
|||
return "I am _ComplexObject(%r)" % self.name
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.name)
|
||||
return six.text_type(self.name)
|
||||
|
||||
def __repr__(self):
|
||||
return "_ComplexObject(%r)" % self.name
|
||||
|
@ -58,7 +59,7 @@ class TestUtilsSimpleLazyObject(TestCase):
|
|||
str(SimpleLazyObject(complex_object)))
|
||||
|
||||
def test_unicode(self):
|
||||
self.assertEqual("joe", unicode(SimpleLazyObject(complex_object)))
|
||||
self.assertEqual("joe", six.text_type(SimpleLazyObject(complex_object)))
|
||||
|
||||
def test_class(self):
|
||||
# This is important for classes that use __class__ in things like
|
||||
|
@ -108,5 +109,5 @@ class TestUtilsSimpleLazyObject(TestCase):
|
|||
pickled = pickle.dumps(x)
|
||||
unpickled = pickle.loads(pickled)
|
||||
self.assertEqual(unpickled, x)
|
||||
self.assertEqual(unicode(unpickled), unicode(x))
|
||||
self.assertEqual(six.text_type(unpickled), six.text_type(x))
|
||||
self.assertEqual(unpickled.name, x.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue