mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
[py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under Python 2 for backwards compatibility). * Renamed smart_str to smart_bytes. * Re-introduced smart_str as an alias for smart_text under Python 3 and smart_bytes under Python 2 (which is backwards compatible). Thus smart_str always returns a str objects. * Used the new smart_str in a few places where both Python 2 and 3 want a str.
This commit is contained in:
parent
ee191715ea
commit
c5ef65bcf3
125 changed files with 629 additions and 583 deletions
|
@ -17,7 +17,7 @@ from django.core.files.storage import default_storage
|
|||
from django.core.management import call_command
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.utils.encoding import smart_unicode
|
||||
from django.utils.encoding import smart_text
|
||||
from django.utils.functional import empty
|
||||
from django.utils._os import rmtree_errorhandler
|
||||
from django.utils import six
|
||||
|
@ -80,7 +80,7 @@ class BaseStaticFilesTestCase(object):
|
|||
os.unlink(self._backup_filepath)
|
||||
|
||||
def assertFileContains(self, filepath, text):
|
||||
self.assertIn(text, self._get_file(smart_unicode(filepath)),
|
||||
self.assertIn(text, self._get_file(smart_text(filepath)),
|
||||
"'%s' not in '%s'" % (text, filepath))
|
||||
|
||||
def assertFileNotFound(self, filepath):
|
||||
|
@ -199,7 +199,7 @@ class TestFindStatic(CollectionTestCase, TestDefaults):
|
|||
out.seek(0)
|
||||
lines = [l.strip() for l in out.readlines()]
|
||||
contents = codecs.open(
|
||||
smart_unicode(lines[1].strip()), "r", "utf-8").read()
|
||||
smart_text(lines[1].strip()), "r", "utf-8").read()
|
||||
return contents
|
||||
|
||||
def test_all_files(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue