diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-20 14:48:51 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-22 09:29:54 +0200 |
| commit | bdca5ea345c548a82a80d198906818c9ccbef896 (patch) | |
| tree | 5c3f5fe5ad2522175d67b96a1fce1ff1763ba125 /django/test | |
| parent | 3cb2457f46b3e40ff6b6acffcb3fd44cbea091e5 (diff) | |
[py3] Replaced unicode/str by six.text_type/bytes.
Diffstat (limited to 'django/test')
| -rw-r--r-- | django/test/_doctest.py | 2 | ||||
| -rw-r--r-- | django/test/html.py | 6 | ||||
| -rw-r--r-- | django/test/testcases.py | 5 |
3 files changed, 7 insertions, 6 deletions
diff --git a/django/test/_doctest.py b/django/test/_doctest.py index 0388714094..75f16e202a 100644 --- a/django/test/_doctest.py +++ b/django/test/_doctest.py @@ -211,7 +211,7 @@ def _normalize_module(module, depth=2): """ if inspect.ismodule(module): return module - elif isinstance(module, (str, unicode)): + elif isinstance(module, six.string_types): return __import__(module, globals(), locals(), ["*"]) elif module is None: return sys.modules[sys._getframe(depth).f_globals['__name__']] diff --git a/django/test/html.py b/django/test/html.py index a44eb72322..8d577d91fd 100644 --- a/django/test/html.py +++ b/django/test/html.py @@ -125,14 +125,14 @@ class Element(object): output += ' %s' % key if self.children: output += '>\n' - output += ''.join(unicode(c) for c in self.children) + output += ''.join(six.text_type(c) for c in self.children) output += '\n</%s>' % self.name else: output += ' />' return output def __repr__(self): - return unicode(self) + return six.text_type(self) class RootElement(Element): @@ -140,7 +140,7 @@ class RootElement(Element): super(RootElement, self).__init__(None, ()) def __unicode__(self): - return ''.join(unicode(c) for c in self.children) + return ''.join(six.text_type(c) for c in self.children) class Parser(HTMLParser): diff --git a/django/test/testcases.py b/django/test/testcases.py index 0a0b029796..eb7bd70d12 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -38,6 +38,7 @@ from django.test.utils import (get_warnings_state, restore_warnings_state, from django.test.utils import ContextList from django.utils import unittest as ut2 from django.utils.encoding import smart_str, force_unicode +from django.utils import six from django.utils.unittest.util import safe_repr from django.views.static import serve @@ -421,8 +422,8 @@ class SimpleTestCase(ut2.TestCase): standardMsg = '%s != %s' % ( safe_repr(dom1, True), safe_repr(dom2, True)) diff = ('\n' + '\n'.join(difflib.ndiff( - unicode(dom1).splitlines(), - unicode(dom2).splitlines()))) + six.text_type(dom1).splitlines(), + six.text_type(dom2).splitlines()))) standardMsg = self._truncateMessage(standardMsg, diff) self.fail(self._formatMessage(msg, standardMsg)) |
