diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-06-07 18:08:47 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-06-07 18:08:47 +0200 |
| commit | 4a103086d5c67fa4fcc53c106c9fdf644c742dd8 (patch) | |
| tree | 3df00600c27f6369f7561c3b8ddf2f97d2d341d9 /django/test/html.py | |
| parent | 706fd9adc0b6587c7f96a834c757708e64fcf615 (diff) | |
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.
Diffstat (limited to 'django/test/html.py')
| -rw-r--r-- | django/test/html.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/django/test/html.py b/django/test/html.py index f1e4897efd..79b198f1be 100644 --- a/django/test/html.py +++ b/django/test/html.py @@ -1,6 +1,9 @@ """ Comparing two html documents. """ + +from __future__ import unicode_literals + import re from HTMLParser import HTMLParseError from django.utils.encoding import force_unicode @@ -113,18 +116,18 @@ class Element(object): return self.children[key] def __unicode__(self): - output = u'<%s' % self.name + output = '<%s' % self.name for key, value in self.attributes: if value: - output += u' %s="%s"' % (key, value) + output += ' %s="%s"' % (key, value) else: - output += u' %s' % key + output += ' %s' % key if self.children: - output += u'>\n' - output += u''.join(unicode(c) for c in self.children) - output += u'\n</%s>' % self.name + output += '>\n' + output += ''.join(unicode(c) for c in self.children) + output += '\n</%s>' % self.name else: - output += u' />' + output += ' />' return output def __repr__(self): @@ -136,7 +139,7 @@ class RootElement(Element): super(RootElement, self).__init__(None, ()) def __unicode__(self): - return u''.join(unicode(c) for c in self.children) + return ''.join(unicode(c) for c in self.children) class Parser(HTMLParser): |
