Fix E901 SyntaxError in python3.2
This commit is contained in:
@@ -259,7 +259,7 @@ class OfflineGenerationInlineNonAsciiTestCase(OfflineTestCaseMixin, TestCase):
|
||||
def setUp(self):
|
||||
self.old_offline_context = settings.COMPRESS_OFFLINE_CONTEXT
|
||||
settings.COMPRESS_OFFLINE_CONTEXT = {
|
||||
'test_non_ascii_value': u'\u2014',
|
||||
'test_non_ascii_value': '\u2014',
|
||||
}
|
||||
super(OfflineGenerationInlineNonAsciiTestCase, self).setUp()
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ An implementation of the advanced string formatting (PEP 3101).
|
||||
Author: Florent Xicluna
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from django.utils import six
|
||||
@@ -140,9 +142,9 @@ class FormattableString(object):
|
||||
|
||||
The method format() behaves like str.format() in python 2.6+.
|
||||
|
||||
>>> FormattableString(u'{a:5}').format(a=42)
|
||||
... # Same as u'{a:5}'.format(a=42)
|
||||
u' 42'
|
||||
>>> FormattableString('{a:5}').format(a=42)
|
||||
... # Same as '{a:5}'.format(a=42)
|
||||
' 42'
|
||||
|
||||
"""
|
||||
|
||||
@@ -246,12 +248,12 @@ def selftest():
|
||||
import datetime
|
||||
F = FormattableString
|
||||
|
||||
assert F(u"{0:{width}.{precision}s}").format('hello world',
|
||||
width=8, precision=5) == u'hello '
|
||||
assert F("{0:{width}.{precision}s}").format('hello world',
|
||||
width=8, precision=5) == 'hello '
|
||||
|
||||
d = datetime.date(2010, 9, 7)
|
||||
assert F(u"The year is {0.year}").format(d) == u"The year is 2010"
|
||||
assert F(u"Tested on {0:%Y-%m-%d}").format(d) == u"Tested on 2010-09-07"
|
||||
assert F("The year is {0.year}").format(d) == "The year is 2010"
|
||||
assert F("Tested on {0:%Y-%m-%d}").format(d) == "Tested on 2010-09-07"
|
||||
print('Test successful')
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user