1
0
mirror of https://github.com/django/django.git synced 2025-06-03 18:49:12 +00:00

Fixed #21285 -- Fixed E121,E122 pep8 warnings

This commit is contained in:
Alasdair Nicol 2013-10-17 23:27:45 +01:00 committed by Tim Graham
parent d97bec5ee3
commit dfb4cb9970
34 changed files with 149 additions and 150 deletions

View File

@ -198,7 +198,7 @@ TEMPLATE_DIRS = ()
TEMPLATE_LOADERS = ( TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader', 'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader', 'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader', # 'django.template.loaders.eggs.Loader',
) )
# List of processors used by RequestContext to populate the context. # List of processors used by RequestContext to populate the context.
@ -211,7 +211,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.media', 'django.core.context_processors.media',
'django.core.context_processors.static', 'django.core.context_processors.static',
'django.core.context_processors.tz', 'django.core.context_processors.tz',
# 'django.core.context_processors.request', # 'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
) )
@ -456,8 +456,8 @@ MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
# 'django.middleware.http.ConditionalGetMiddleware', # 'django.middleware.http.ConditionalGetMiddleware',
# 'django.middleware.gzip.GZipMiddleware', # 'django.middleware.gzip.GZipMiddleware',
) )
############ ############
@ -607,7 +607,7 @@ STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATICFILES_FINDERS = ( STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder', # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
) )
############## ##############

View File

@ -166,9 +166,8 @@ class RelatedFieldListFilter(FieldListFilter):
rel_name = other_model._meta.pk.name rel_name = other_model._meta.pk.name
self.lookup_kwarg = '%s__%s__exact' % (field_path, rel_name) self.lookup_kwarg = '%s__%s__exact' % (field_path, rel_name)
self.lookup_kwarg_isnull = '%s__isnull' % field_path self.lookup_kwarg_isnull = '%s__isnull' % field_path
self.lookup_val = request.GET.get(self.lookup_kwarg, None) self.lookup_val = request.GET.get(self.lookup_kwarg)
self.lookup_val_isnull = request.GET.get( self.lookup_val_isnull = request.GET.get(self.lookup_kwarg_isnull)
self.lookup_kwarg_isnull, None)
self.lookup_choices = field.get_choices(include_blank=False) self.lookup_choices = field.get_choices(include_blank=False)
super(RelatedFieldListFilter, self).__init__( super(RelatedFieldListFilter, self).__init__(
field, request, params, model, model_admin, field_path) field, request, params, model, model_admin, field_path)

View File

@ -1198,9 +1198,9 @@ class ModelAdmin(BaseModelAdmin):
self.message_user(request, _( self.message_user(request, _(
'The %(name)s "%(obj)s" was deleted successfully.') % { 'The %(name)s "%(obj)s" was deleted successfully.') % {
'name': force_text(opts.verbose_name), 'name': force_text(opts.verbose_name),
'obj': force_text(obj_display)}, 'obj': force_text(obj_display)
messages.SUCCESS) }, messages.SUCCESS)
if self.has_change_permission(request, None): if self.has_change_permission(request, None):
post_url = reverse('admin:%s_%s_changelist' % post_url = reverse('admin:%s_%s_changelist' %
@ -1221,10 +1221,10 @@ class ModelAdmin(BaseModelAdmin):
return TemplateResponse(request, return TemplateResponse(request,
self.delete_confirmation_template or [ self.delete_confirmation_template or [
"admin/{}/{}/delete_confirmation.html".format(app_label, opts.model_name), "admin/{}/{}/delete_confirmation.html".format(app_label, opts.model_name),
"admin/{}/delete_confirmation.html".format(app_label), "admin/{}/delete_confirmation.html".format(app_label),
"admin/delete_confirmation.html" "admin/delete_confirmation.html"
], context, current_app=self.admin_site.name) ], context, current_app=self.admin_site.name)
@csrf_protect_m @csrf_protect_m
@transaction.atomic @transaction.atomic

View File

@ -49,9 +49,9 @@ def _is_changelist_popup(request):
IS_LEGACY_POPUP_VAR = 'pop' IS_LEGACY_POPUP_VAR = 'pop'
if IS_LEGACY_POPUP_VAR in request.GET: if IS_LEGACY_POPUP_VAR in request.GET:
warnings.warn( warnings.warn(
"The `%s` GET parameter has been renamed to `%s`." % "The `%s` GET parameter has been renamed to `%s`." %
(IS_LEGACY_POPUP_VAR, IS_POPUP_VAR), (IS_LEGACY_POPUP_VAR, IS_POPUP_VAR),
DeprecationWarning, 2) DeprecationWarning, 2)
return True return True
return False return False

View File

@ -106,7 +106,7 @@ class AuthenticationFormTest(TestCase):
self.assertFalse(form.is_valid()) self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(), self.assertEqual(form.non_field_errors(),
[force_text(form.error_messages['invalid_login'] % { [force_text(form.error_messages['invalid_login'] % {
'username': User._meta.get_field('username').verbose_name 'username': User._meta.get_field('username').verbose_name
})]) })])
def test_inactive_user(self): def test_inactive_user(self):

View File

@ -217,7 +217,7 @@ class PermissionTestCase(TestCase):
""" """
# check duplicated default permission # check duplicated default permission
models.Permission._meta.permissions = [ models.Permission._meta.permissions = [
('change_permission', 'Can edit permission (duplicate)')] ('change_permission', 'Can edit permission (duplicate)')]
six.assertRaisesRegex(self, CommandError, six.assertRaisesRegex(self, CommandError,
"The permission codename 'change_permission' clashes with a " "The permission codename 'change_permission' clashes with a "
"builtin permission for model 'auth.Permission'.", "builtin permission for model 'auth.Permission'.",

View File

@ -13,10 +13,10 @@ urlpatterns = patterns('',
('form2', Page2), ('form2', Page2),
('form3', Page3), ('form3', Page3),
('form4', Page4)])), ('form4', Page4)])),
url(r'^wiz_other_template/$', CookieContactWizard.as_view( url(r'^wiz_other_template/$', CookieContactWizard.as_view(
[('form1', Page1), [('form1', Page1),
('form2', Page2), ('form2', Page2),
('form3', Page3), ('form3', Page3),
('form4', Page4)], ('form4', Page4)],
template_name='other_wizard_form.html')), template_name='other_wizard_form.html')),
) )

View File

@ -36,7 +36,7 @@ class OpenLayersWidget(Textarea):
except (GEOSException, ValueError) as err: except (GEOSException, ValueError) as err:
logger.error( logger.error(
"Error creating geometry from value '%s' (%s)" % ( "Error creating geometry from value '%s' (%s)" % (
value, err) value, err)
) )
value = None value = None
@ -68,7 +68,7 @@ class OpenLayersWidget(Textarea):
except OGRException as err: except OGRException as err:
logger.error( logger.error(
"Error transforming geometry from srid '%s' to srid '%s' (%s)" % ( "Error transforming geometry from srid '%s' to srid '%s' (%s)" % (
value.srid, srid, err) value.srid, srid, err)
) )
wkt = '' wkt = ''
else: else:

View File

@ -9,6 +9,6 @@ from django.contrib.gis.db.models.manager import GeoManager
# The geographic-enabled fields. # The geographic-enabled fields.
from django.contrib.gis.db.models.fields import ( from django.contrib.gis.db.models.fields import (
GeometryField, PointField, LineStringField, PolygonField, GeometryField, PointField, LineStringField, PolygonField,
MultiPointField, MultiLineStringField, MultiPolygonField, MultiPointField, MultiLineStringField, MultiPolygonField,
GeometryCollectionField) GeometryCollectionField)

View File

@ -43,7 +43,7 @@ class BaseGeometryWidget(Widget):
except (GEOSException, ValueError) as err: except (GEOSException, ValueError) as err:
logger.error( logger.error(
"Error creating geometry from value '%s' (%s)" % ( "Error creating geometry from value '%s' (%s)" % (
value, err) value, err)
) )
return None return None
@ -63,7 +63,7 @@ class BaseGeometryWidget(Widget):
except gdal.OGRException as err: except gdal.OGRException as err:
logger.error( logger.error(
"Error transforming geometry from srid '%s' to srid '%s' (%s)" % ( "Error transforming geometry from srid '%s' to srid '%s' (%s)" % (
value.srid, self.map_srid, err) value.srid, self.map_srid, err)
) )
context = self.build_attrs(attrs, context = self.build_attrs(attrs,

View File

@ -34,7 +34,7 @@ class Message(object):
def __eq__(self, other): def __eq__(self, other):
return isinstance(other, Message) and self.level == other.level and \ return isinstance(other, Message) and self.level == other.level and \
self.message == other.message self.message == other.message
def __str__(self): def __str__(self):
return force_text(self.message) return force_text(self.message)

View File

@ -219,7 +219,7 @@ class BaseTests(object):
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES), lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter( TEMPLATE_CONTEXT_PROCESSORS=filter(
lambda p:'context_processors.messages' not in p, lambda p:'context_processors.messages' not in p,
settings.TEMPLATE_CONTEXT_PROCESSORS), settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG MESSAGE_LEVEL=constants.DEBUG
) )
def test_middleware_disabled(self): def test_middleware_disabled(self):
@ -244,7 +244,7 @@ class BaseTests(object):
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES), lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter( TEMPLATE_CONTEXT_PROCESSORS=filter(
lambda p:'context_processors.messages' not in p, lambda p:'context_processors.messages' not in p,
settings.TEMPLATE_CONTEXT_PROCESSORS), settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG MESSAGE_LEVEL=constants.DEBUG
) )
def test_middleware_disabled_fail_silently(self): def test_middleware_disabled_fail_silently(self):

View File

@ -251,9 +251,9 @@ def get_validation_errors(outfile, app=None):
"than one foreign key to %s, which is " "than one foreign key to %s, which is "
"ambiguous and is not permitted." % ( "ambiguous and is not permitted." % (
f.rel.through._meta.object_name, f.rel.through._meta.object_name,
from_model._meta.object_name from_model._meta.object_name
) )
) )
else: else:
seen_from = True seen_from = True
elif rel_to == to_model: elif rel_to == to_model:

View File

@ -439,9 +439,9 @@ class BaseDatabaseCreation(object):
settings_dict['NAME'] = old_database_name settings_dict['NAME'] = old_database_name
backend = load_backend(settings_dict['ENGINE']) backend = load_backend(settings_dict['ENGINE'])
new_connection = backend.DatabaseWrapper( new_connection = backend.DatabaseWrapper(
settings_dict, settings_dict,
alias='__destroy_test_db__', alias='__destroy_test_db__',
allow_thread_sharing=False) allow_thread_sharing=False)
new_connection.creation._destroy_test_db(test_database_name, verbosity) new_connection.creation._destroy_test_db(test_database_name, verbosity)
def _destroy_test_db(self, test_database_name, verbosity): def _destroy_test_db(self, test_database_name, verbosity):

View File

@ -566,8 +566,8 @@ class Model(six.with_metaclass(ModelBase)):
deferred_fields = [ deferred_fields = [
f.attname for f in self._meta.fields f.attname for f in self._meta.fields
if f.attname not in self.__dict__ if f.attname not in self.__dict__
and isinstance(self.__class__.__dict__[f.attname], and isinstance(self.__class__.__dict__[f.attname],
DeferredAttribute)] DeferredAttribute)]
loaded_fields = field_names.difference(deferred_fields) loaded_fields = field_names.difference(deferred_fields)
if loaded_fields: if loaded_fields:

View File

@ -704,7 +704,7 @@ class AutoField(Field):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
assert kwargs.get('primary_key', False) is True, \ assert kwargs.get('primary_key', False) is True, \
"%ss must have primary_key=True." % self.__class__.__name__ "%ss must have primary_key=True." % self.__class__.__name__
kwargs['blank'] = True kwargs['blank'] = True
Field.__init__(self, *args, **kwargs) Field.__init__(self, *args, **kwargs)
@ -746,7 +746,7 @@ class AutoField(Field):
def contribute_to_class(self, cls, name): def contribute_to_class(self, cls, name):
assert not cls._meta.has_auto_field, \ assert not cls._meta.has_auto_field, \
"A model can't have more than one AutoField." "A model can't have more than one AutoField."
super(AutoField, self).contribute_to_class(cls, name) super(AutoField, self).contribute_to_class(cls, name)
cls._meta.has_auto_field = True cls._meta.has_auto_field = True
cls._meta.auto_field = self cls._meta.auto_field = self

View File

@ -1247,8 +1247,8 @@ class ForeignKey(ForeignObject):
using = router.db_for_read(model_instance.__class__, instance=model_instance) using = router.db_for_read(model_instance.__class__, instance=model_instance)
qs = self.rel.to._default_manager.using(using).filter( qs = self.rel.to._default_manager.using(using).filter(
**{self.rel.field_name: value} **{self.rel.field_name: value}
) )
qs = qs.complex_filter(self.rel.limit_choices_to) qs = qs.complex_filter(self.rel.limit_choices_to)
if not qs.exists(): if not qs.exists():
raise exceptions.ValidationError( raise exceptions.ValidationError(

View File

@ -515,7 +515,7 @@ filter_raw_string = r"""
'var_chars': "\w\.", 'var_chars': "\w\.",
'filter_sep': re.escape(FILTER_SEPARATOR), 'filter_sep': re.escape(FILTER_SEPARATOR),
'arg_sep': re.escape(FILTER_ARGUMENT_SEPARATOR), 'arg_sep': re.escape(FILTER_ARGUMENT_SEPARATOR),
} }
filter_re = re.compile(filter_raw_string, re.UNICODE | re.VERBOSE) filter_re = re.compile(filter_raw_string, re.UNICODE | re.VERBOSE)

View File

@ -282,8 +282,7 @@ class SimpleTestCase(unittest.TestCase):
" response code was %d (expected %d)" % " response code was %d (expected %d)" %
(path, redirect_response.status_code, target_status_code)) (path, redirect_response.status_code, target_status_code))
e_scheme, e_netloc, e_path, e_query, e_fragment = urlsplit( e_scheme, e_netloc, e_path, e_query, e_fragment = urlsplit(expected_url)
expected_url)
if not (e_scheme or e_netloc): if not (e_scheme or e_netloc):
expected_url = urlunsplit(('http', host or 'testserver', e_path, expected_url = urlunsplit(('http', host or 'testserver', e_path,
e_query, e_fragment)) e_query, e_fragment))
@ -850,10 +849,10 @@ class TestCase(TransactionTestCase):
try: try:
call_command('loaddata', *self.fixtures, call_command('loaddata', *self.fixtures,
**{ **{
'verbosity': 0, 'verbosity': 0,
'commit': False, 'commit': False,
'database': db_name, 'database': db_name,
'skip_validation': True, 'skip_validation': True,
}) })
except Exception: except Exception:
self._fixture_teardown() self._fixture_teardown()

View File

@ -145,12 +145,12 @@ class JsLexer(Lexer):
states = { states = {
'div': # slash will mean division 'div': # slash will mean division
both_before + [ both_before + [
Tok("punct", literals("/= /"), next='reg'), Tok("punct", literals("/= /"), next='reg'),
] + both_after, ] + both_after,
'reg': # slash will mean regex 'reg': # slash will mean regex
both_before + [ both_before + [
Tok("regex", Tok("regex",
r""" r"""
/ # opening slash / # opening slash
# First character is.. # First character is..

View File

@ -65,8 +65,9 @@ def sensitive_post_parameters(*parameters):
@functools.wraps(view) @functools.wraps(view)
def sensitive_post_parameters_wrapper(request, *args, **kwargs): def sensitive_post_parameters_wrapper(request, *args, **kwargs):
assert isinstance(request, HttpRequest), ( assert isinstance(request, HttpRequest), (
"sensitive_post_parameters didn't receive an HttpRequest. If you " "sensitive_post_parameters didn't receive an HttpRequest. "
"are decorating a classmethod, be sure to use @method_decorator." "If you are decorating a classmethod, be sure to use "
"@method_decorator."
) )
if parameters: if parameters:
request.sensitive_post_parameters = parameters request.sensitive_post_parameters = parameters

View File

@ -226,8 +226,8 @@ latex_elements = {
# (source start file, target name, title, author, document class [howto/manual]). # (source start file, target name, title, author, document class [howto/manual]).
#latex_documents = [] #latex_documents = []
latex_documents = [ latex_documents = [
('contents', 'django.tex', 'Django Documentation', ('contents', 'django.tex', 'Django Documentation',
'Django Software Foundation', 'manual'), 'Django Software Foundation', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of

View File

@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
[flake8] [flake8]
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py
ignore=E123,E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E121,E122,E203,E221,E227,E231,E261,E301,E303,E502,F401,F403,F841,W601 ignore=E123,E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,E303,E502,F401,F403,F841,W601
[metadata] [metadata]
license-file = LICENSE license-file = LICENSE

View File

@ -94,8 +94,8 @@ class BulkCreateTests(TestCase):
with override_settings(DEBUG=True): with override_settings(DEBUG=True):
connection.queries = [] connection.queries = []
TwoFields.objects.bulk_create([ TwoFields.objects.bulk_create([
TwoFields(f1=i, f2=i+1) for i in range(0, 1001) TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
]) ])
self.assertEqual(TwoFields.objects.count(), 1001) self.assertEqual(TwoFields.objects.count(), 1001)
self.assertEqual( self.assertEqual(
TwoFields.objects.filter(f1__gte=450, f1__lte=550).count(), TwoFields.objects.filter(f1__gte=450, f1__lte=550).count(),
@ -115,8 +115,8 @@ class BulkCreateTests(TestCase):
with override_settings(DEBUG=True): with override_settings(DEBUG=True):
connection.queries = [] connection.queries = []
TwoFields.objects.bulk_create([ TwoFields.objects.bulk_create([
TwoFields(f1=i, f2=i+1) for i in range(0, 1001) TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
]) ])
self.assertTrue(len(connection.queries) < 10) self.assertTrue(len(connection.queries) < 10)
def test_large_batch_mixed(self): def test_large_batch_mixed(self):

View File

@ -867,7 +867,7 @@ class DBCacheTests(BaseCacheTests, TransactionTestCase):
def test_second_call_doesnt_crash(self): def test_second_call_doesnt_crash(self):
stdout = six.StringIO() stdout = six.StringIO()
management.call_command( management.call_command(
'createcachetable', 'createcachetable',
stdout=stdout stdout=stdout
) )
self.assertEqual(stdout.getvalue(), self.assertEqual(stdout.getvalue(),

View File

@ -306,14 +306,14 @@ class ExtraRegressTests(TestCase):
self.assertQuerysetEqual( self.assertQuerysetEqual(
TestObject.objects.filter( TestObject.objects.filter(
pk__in=TestObject.objects.values('pk').extra(select={'extra': 1}) pk__in=TestObject.objects.values('pk').extra(select={'extra': 1})
), ),
['<TestObject: TestObject: first,second,third>'] ['<TestObject: TestObject: first,second,third>']
) )
self.assertQuerysetEqual( self.assertQuerysetEqual(
TestObject.objects.filter(pk=obj.pk) | TestObject.objects.filter(pk=obj.pk) |
TestObject.objects.extra(where=["id > %s"], params=[obj.pk]), TestObject.objects.extra(where=["id > %s"], params=[obj.pk]),
['<TestObject: TestObject: first,second,third>'] ['<TestObject: TestObject: first,second,third>']
) )

View File

@ -23,7 +23,7 @@ class FormsMediaTestCase(TestCase):
class Foo: class Foo:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -52,7 +52,7 @@ class FormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -77,21 +77,21 @@ class FormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
class MyWidget2(TextInput): class MyWidget2(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css2','/path/to/css3') 'all': ('/path/to/css2','/path/to/css3')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput): class MyWidget3(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -158,7 +158,7 @@ class FormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -185,7 +185,7 @@ class FormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -203,7 +203,7 @@ class FormsMediaTestCase(TestCase):
class MyWidget8(MyWidget1): class MyWidget8(MyWidget1):
class Media: class Media:
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -222,7 +222,7 @@ class FormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -249,7 +249,7 @@ class FormsMediaTestCase(TestCase):
class Media: class Media:
extend = False extend = False
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -264,7 +264,7 @@ class FormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -272,7 +272,7 @@ class FormsMediaTestCase(TestCase):
class Media: class Media:
extend = True extend = True
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -290,7 +290,7 @@ class FormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -298,7 +298,7 @@ class FormsMediaTestCase(TestCase):
class Media: class Media:
extend = ('css',) extend = ('css',)
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -318,9 +318,9 @@ class FormsMediaTestCase(TestCase):
class MultimediaWidget(TextInput): class MultimediaWidget(TextInput):
class Media: class Media:
css = { css = {
'screen, print': ('/file1','/file2'), 'screen, print': ('/file1','/file2'),
'screen': ('/file3',), 'screen': ('/file3',),
'print': ('/file4',) 'print': ('/file4',)
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -340,21 +340,21 @@ class FormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
class MyWidget2(TextInput): class MyWidget2(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css2','/path/to/css3') 'all': ('/path/to/css2','/path/to/css3')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput): class MyWidget3(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -382,21 +382,21 @@ class FormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
class MyWidget2(TextInput): class MyWidget2(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css2','/path/to/css3') 'all': ('/path/to/css2','/path/to/css3')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput): class MyWidget3(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -474,7 +474,7 @@ class StaticFormsMediaTestCase(TestCase):
class Foo: class Foo:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -503,7 +503,7 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -528,21 +528,21 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
class MyWidget2(TextInput): class MyWidget2(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css2','/path/to/css3') 'all': ('/path/to/css2','/path/to/css3')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput): class MyWidget3(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -609,7 +609,7 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -636,7 +636,7 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -654,7 +654,7 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget8(MyWidget1): class MyWidget8(MyWidget1):
class Media: class Media:
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -673,7 +673,7 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -700,7 +700,7 @@ class StaticFormsMediaTestCase(TestCase):
class Media: class Media:
extend = False extend = False
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -715,7 +715,7 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -723,7 +723,7 @@ class StaticFormsMediaTestCase(TestCase):
class Media: class Media:
extend = True extend = True
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -741,7 +741,7 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
@ -749,7 +749,7 @@ class StaticFormsMediaTestCase(TestCase):
class Media: class Media:
extend = ('css',) extend = ('css',)
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -769,9 +769,9 @@ class StaticFormsMediaTestCase(TestCase):
class MultimediaWidget(TextInput): class MultimediaWidget(TextInput):
class Media: class Media:
css = { css = {
'screen, print': ('/file1','/file2'), 'screen, print': ('/file1','/file2'),
'screen': ('/file3',), 'screen': ('/file3',),
'print': ('/file4',) 'print': ('/file4',)
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -791,21 +791,21 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
class MyWidget2(TextInput): class MyWidget2(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css2','/path/to/css3') 'all': ('/path/to/css2','/path/to/css3')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput): class MyWidget3(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
@ -833,21 +833,21 @@ class StaticFormsMediaTestCase(TestCase):
class MyWidget1(TextInput): class MyWidget1(TextInput):
class Media: class Media:
css = { css = {
'all': ('path/to/css1','/path/to/css2') 'all': ('path/to/css1','/path/to/css2')
} }
js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3') js = ('/path/to/js1','http://media.other.com/path/to/js2','https://secure.other.com/path/to/js3')
class MyWidget2(TextInput): class MyWidget2(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css2','/path/to/css3') 'all': ('/path/to/css2','/path/to/css3')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput): class MyWidget3(TextInput):
class Media: class Media:
css = { css = {
'all': ('/path/to/css3','path/to/css1') 'all': ('/path/to/css3','path/to/css1')
} }
js = ('/path/to/js1','/path/to/js4') js = ('/path/to/js1','/path/to/js4')

View File

@ -131,7 +131,7 @@ class ModelTests(TestCase):
datetime.date(1, 3, 3), datetime.date(1, 3, 3),
], ],
attrgetter("when") attrgetter("when")
) )
if (3,) <= sys.version_info < (3, 3) and connection.vendor == 'mysql': if (3,) <= sys.version_info < (3, 3) and connection.vendor == 'mysql':
# In Python < 3.3, datetime.strftime raises an exception for years # In Python < 3.3, datetime.strftime raises an exception for years

View File

@ -440,9 +440,9 @@ class ForeignKeyToFieldTest(TestCase):
with self.assertNumQueries(3): with self.assertNumQueries(3):
qs = Author.objects.all().prefetch_related('favorite_authors', 'favors_me') qs = Author.objects.all().prefetch_related('favorite_authors', 'favors_me')
favorites = [( favorites = [(
[six.text_type(i_like) for i_like in author.favorite_authors.all()], [six.text_type(i_like) for i_like in author.favorite_authors.all()],
[six.text_type(likes_me) for likes_me in author.favors_me.all()] [six.text_type(likes_me) for likes_me in author.favors_me.all()]
) for author in qs] ) for author in qs]
self.assertEqual( self.assertEqual(
favorites, favorites,
[ [

View File

@ -246,9 +246,9 @@ class SerializersTestBase(object):
# Regression for #12524 -- dates before 1000AD get prefixed # Regression for #12524 -- dates before 1000AD get prefixed
# 0's on the year # 0's on the year
a = Article.objects.create( a = Article.objects.create(
author = self.jane, author = self.jane,
headline = "Nobody remembers the early years", headline = "Nobody remembers the early years",
pub_date = datetime(1, 2, 3, 4, 5, 6)) pub_date = datetime(1, 2, 3, 4, 5, 6))
serial_str = serializers.serialize(self.serializer_name, [a]) serial_str = serializers.serialize(self.serializer_name, [a])
date_values = self._get_field_values(serial_str, "pub_date") date_values = self._get_field_values(serial_str, "pub_date")

View File

@ -121,13 +121,13 @@ def data_compare(testcase, pk, klass, data):
if klass == BinaryData and data is not None: if klass == BinaryData and data is not None:
testcase.assertEqual(bytes(data), bytes(instance.data), testcase.assertEqual(bytes(data), bytes(instance.data),
"Objects with PK=%d not equal; expected '%s' (%s), got '%s' (%s)" % ( "Objects with PK=%d not equal; expected '%s' (%s), got '%s' (%s)" % (
pk, repr(bytes(data)), type(data), repr(bytes(instance.data)), pk, repr(bytes(data)), type(data), repr(bytes(instance.data)),
type(instance.data)) type(instance.data))
) )
else: else:
testcase.assertEqual(data, instance.data, testcase.assertEqual(data, instance.data,
"Objects with PK=%d not equal; expected '%s' (%s), got '%s' (%s)" % ( "Objects with PK=%d not equal; expected '%s' (%s), got '%s' (%s)" % (
pk, data, type(data), instance, type(instance.data)) pk, data, type(data), instance, type(instance.data))
) )
def generic_compare(testcase, pk, klass, data): def generic_compare(testcase, pk, klass, data):
@ -205,7 +205,7 @@ test_data = [
(data_obj, 41, EmailData, None), (data_obj, 41, EmailData, None),
(data_obj, 42, EmailData, ""), (data_obj, 42, EmailData, ""),
(data_obj, 50, FileData, 'file:///foo/bar/whiz.txt'), (data_obj, 50, FileData, 'file:///foo/bar/whiz.txt'),
# (data_obj, 51, FileData, None), # (data_obj, 51, FileData, None),
(data_obj, 52, FileData, ""), (data_obj, 52, FileData, ""),
(data_obj, 60, FilePathData, "/foo/bar/whiz.txt"), (data_obj, 60, FilePathData, "/foo/bar/whiz.txt"),
(data_obj, 61, FilePathData, None), (data_obj, 61, FilePathData, None),
@ -308,10 +308,10 @@ The end."""),
(pk_obj, 601, BooleanPKData, True), (pk_obj, 601, BooleanPKData, True),
(pk_obj, 602, BooleanPKData, False), (pk_obj, 602, BooleanPKData, False),
(pk_obj, 610, CharPKData, "Test Char PKData"), (pk_obj, 610, CharPKData, "Test Char PKData"),
# (pk_obj, 620, DatePKData, datetime.date(2006,6,16)), # (pk_obj, 620, DatePKData, datetime.date(2006,6,16)),
# (pk_obj, 630, DateTimePKData, datetime.datetime(2006,6,16,10,42,37)), # (pk_obj, 630, DateTimePKData, datetime.datetime(2006,6,16,10,42,37)),
(pk_obj, 640, EmailPKData, "hovercraft@example.com"), (pk_obj, 640, EmailPKData, "hovercraft@example.com"),
# (pk_obj, 650, FilePKData, 'file:///foo/bar/whiz.txt'), # (pk_obj, 650, FilePKData, 'file:///foo/bar/whiz.txt'),
(pk_obj, 660, FilePathPKData, "/foo/bar/whiz.txt"), (pk_obj, 660, FilePathPKData, "/foo/bar/whiz.txt"),
(pk_obj, 670, DecimalPKData, decimal.Decimal('12.345')), (pk_obj, 670, DecimalPKData, decimal.Decimal('12.345')),
(pk_obj, 671, DecimalPKData, decimal.Decimal('-12.345')), (pk_obj, 671, DecimalPKData, decimal.Decimal('-12.345')),
@ -322,7 +322,7 @@ The end."""),
(pk_obj, 680, IntegerPKData, 123456789), (pk_obj, 680, IntegerPKData, 123456789),
(pk_obj, 681, IntegerPKData, -123456789), (pk_obj, 681, IntegerPKData, -123456789),
(pk_obj, 682, IntegerPKData, 0), (pk_obj, 682, IntegerPKData, 0),
# (XX, ImagePKData # (XX, ImagePKData
(pk_obj, 690, IPAddressPKData, "127.0.0.1"), (pk_obj, 690, IPAddressPKData, "127.0.0.1"),
(pk_obj, 695, GenericIPAddressPKData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"), (pk_obj, 695, GenericIPAddressPKData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"),
# (pk_obj, 700, NullBooleanPKData, True), # (pk_obj, 700, NullBooleanPKData, True),
@ -333,12 +333,12 @@ The end."""),
(pk_obj, 750, SmallPKData, 12), (pk_obj, 750, SmallPKData, 12),
(pk_obj, 751, SmallPKData, -12), (pk_obj, 751, SmallPKData, -12),
(pk_obj, 752, SmallPKData, 0), (pk_obj, 752, SmallPKData, 0),
# (pk_obj, 760, TextPKData, """This is a long piece of text. # (pk_obj, 760, TextPKData, """This is a long piece of text.
# It contains line breaks. # It contains line breaks.
# Several of them. # Several of them.
# The end."""), # The end."""),
# (pk_obj, 770, TimePKData, datetime.time(10,42,37)), # (pk_obj, 770, TimePKData, datetime.time(10,42,37)),
# (pk_obj, 790, XMLPKData, "<foo></foo>"), # (pk_obj, 790, XMLPKData, "<foo></foo>"),
(data_obj, 800, AutoNowDateTimeData, datetime.datetime(2006,6,16,10,42,37)), (data_obj, 800, AutoNowDateTimeData, datetime.datetime(2006,6,16,10,42,37)),
(data_obj, 810, ModifyingSaveData, 42), (data_obj, 810, ModifyingSaveData, 42),

View File

@ -45,9 +45,9 @@ class SignalsRegressTests(TestCase):
# Save up the number of connected signals so that we can check at the end # Save up the number of connected signals so that we can check at the end
# that all the signals we register get properly unregistered (#9989) # that all the signals we register get properly unregistered (#9989)
self.pre_signals = (len(models.signals.pre_save.receivers), self.pre_signals = (len(models.signals.pre_save.receivers),
len(models.signals.post_save.receivers), len(models.signals.post_save.receivers),
len(models.signals.pre_delete.receivers), len(models.signals.pre_delete.receivers),
len(models.signals.post_delete.receivers)) len(models.signals.post_delete.receivers))
models.signals.pre_save.connect(self.pre_save_test) models.signals.pre_save.connect(self.pre_save_test)
models.signals.post_save.connect(self.post_save_test) models.signals.post_save.connect(self.post_save_test)

View File

@ -371,12 +371,12 @@ def get_filter_tests():
'time05': (r'{{ d|time:"P:e:O:T:Z" }}', {'d': today}, ''), 'time05': (r'{{ d|time:"P:e:O:T:Z" }}', {'d': today}, ''),
'time06': (r'{{ obj|time:"P:e:O:T:Z" }}', {'obj': 'non-datetime-value'}, ''), 'time06': (r'{{ obj|time:"P:e:O:T:Z" }}', {'obj': 'non-datetime-value'}, ''),
# Tests for #11687 and #16676 # Tests for #11687 and #16676
'add01': (r'{{ i|add:"5" }}', {'i': 2000}, '2005'), 'add01': (r'{{ i|add:"5" }}', {'i': 2000}, '2005'),
'add02': (r'{{ i|add:"napis" }}', {'i': 2000}, ''), 'add02': (r'{{ i|add:"napis" }}', {'i': 2000}, ''),
'add03': (r'{{ i|add:16 }}', {'i': 'not_an_int'}, ''), 'add03': (r'{{ i|add:16 }}', {'i': 'not_an_int'}, ''),
'add04': (r'{{ i|add:"16" }}', {'i': 'not_an_int'}, 'not_an_int16'), 'add04': (r'{{ i|add:"16" }}', {'i': 'not_an_int'}, 'not_an_int16'),
'add05': (r'{{ l1|add:l2 }}', {'l1': [1, 2], 'l2': [3, 4]}, '[1, 2, 3, 4]'), 'add05': (r'{{ l1|add:l2 }}', {'l1': [1, 2], 'l2': [3, 4]}, '[1, 2, 3, 4]'),
'add06': (r'{{ t1|add:t2 }}', {'t1': (3, 4), 't2': (1, 2)}, '(3, 4, 1, 2)'), 'add06': (r'{{ t1|add:t2 }}', {'t1': (3, 4), 't2': (1, 2)}, '(3, 4, 1, 2)'),
'add07': (r'{{ d|add:t }}', {'d': date(2000, 1, 1), 't': timedelta(10)}, 'Jan. 11, 2000'), 'add07': (r'{{ d|add:t }}', {'d': date(2000, 1, 1), 't': timedelta(10)}, 'Jan. 11, 2000'),
} }

View File

@ -397,13 +397,13 @@ class HTMLEqualTests(TestCase):
def test_complex_examples(self): def test_complex_examples(self):
self.assertHTMLEqual( self.assertHTMLEqual(
"""<tr><th><label for="id_first_name">First name:</label></th> """<tr><th><label for="id_first_name">First name:</label></th>
<td><input type="text" name="first_name" value="John" id="id_first_name" /></td></tr> <td><input type="text" name="first_name" value="John" id="id_first_name" /></td></tr>
<tr><th><label for="id_last_name">Last name:</label></th> <tr><th><label for="id_last_name">Last name:</label></th>
<td><input type="text" id="id_last_name" name="last_name" value="Lennon" /></td></tr> <td><input type="text" id="id_last_name" name="last_name" value="Lennon" /></td></tr>
<tr><th><label for="id_birthday">Birthday:</label></th> <tr><th><label for="id_birthday">Birthday:</label></th>
<td><input type="text" value="1940-10-9" name="birthday" id="id_birthday" /></td></tr>""", <td><input type="text" value="1940-10-9" name="birthday" id="id_birthday" /></td></tr>""",
""" """
<tr><th> <tr><th>
<label for="id_first_name">First name:</label></th><td><input type="text" name="first_name" value="John" id="id_first_name" /> <label for="id_first_name">First name:</label></th><td><input type="text" name="first_name" value="John" id="id_first_name" />
</td></tr> </td></tr>
@ -416,7 +416,7 @@ class HTMLEqualTests(TestCase):
""") """)
self.assertHTMLEqual( self.assertHTMLEqual(
"""<!DOCTYPE html> """<!DOCTYPE html>
<html> <html>
<head> <head>
<link rel="stylesheet"> <link rel="stylesheet">