Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.

Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
This commit is contained in:
Claude Paroz 2012-06-07 18:08:47 +02:00
parent 706fd9adc0
commit 4a103086d5
401 changed files with 6647 additions and 6157 deletions

View file

@ -1,6 +1,9 @@
from __future__ import unicode_literals
import copy
import pickle
from django.test.utils import str_prefix
from django.utils.unittest import TestCase
from django.utils.functional import SimpleLazyObject, empty
@ -51,10 +54,11 @@ class TestUtilsSimpleLazyObject(TestCase):
self.assertTrue("SimpleLazyObject" in repr(SimpleLazyObject(complex_object)))
def test_str(self):
self.assertEqual("I am _ComplexObject('joe')", str(SimpleLazyObject(complex_object)))
self.assertEqual(str_prefix("I am _ComplexObject(%(_)s'joe')"),
str(SimpleLazyObject(complex_object)))
def test_unicode(self):
self.assertEqual(u"joe", unicode(SimpleLazyObject(complex_object)))
self.assertEqual("joe", unicode(SimpleLazyObject(complex_object)))
def test_class(self):
# This is important for classes that use __class__ in things like