Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #21285 -- Fixed E121,E122 pep8 warnings

  • Loading branch information...
commit dfb4cb9970f86487f0aaa88c5dfcfafa31e4f430 1 parent d97bec5
@alasdairnicol alasdairnicol authored timgraham committed
Showing with 149 additions and 150 deletions.
  1. +5 −5 django/conf/global_settings.py
  2. +2 −3 django/contrib/admin/filters.py
  3. +7 −7 django/contrib/admin/options.py
  4. +3 −3 django/contrib/admin/views/main.py
  5. +1 −1  django/contrib/auth/tests/test_forms.py
  6. +1 −1  django/contrib/auth/tests/test_management.py
  7. +6 −6 django/contrib/formtools/tests/wizard/wizardtests/urls.py
  8. +2 −2 django/contrib/gis/admin/widgets.py
  9. +3 −3 django/contrib/gis/db/models/__init__.py
  10. +2 −2 django/contrib/gis/forms/widgets.py
  11. +1 −1  django/contrib/messages/storage/base.py
  12. +2 −2 django/contrib/messages/tests/base.py
  13. +3 −3 django/core/management/validation.py
  14. +3 −3 django/db/backends/creation.py
  15. +2 −2 django/db/models/base.py
  16. +2 −2 django/db/models/fields/__init__.py
  17. +2 −2 django/db/models/fields/related.py
  18. +1 −1  django/template/base.py
  19. +5 −6 django/test/testcases.py
  20. +2 −2 django/utils/jslex.py
  21. +3 −2 django/views/decorators/debug.py
  22. +2 −2 docs/conf.py
  23. +1 −1  setup.cfg
  24. +4 −4 tests/bulk_create/tests.py
  25. +1 −1  tests/cache/tests.py
  26. +2 −2 tests/extra_regress/tests.py
  27. +46 −46 tests/forms_tests/tests/test_media.py
  28. +1 −1  tests/model_regress/tests.py
  29. +3 −3 tests/prefetch_related/tests.py
  30. +3 −3 tests/serializers/tests.py
  31. +14 −14 tests/serializers_regress/tests.py
  32. +3 −3 tests/signals_regress/tests.py
  33. +8 −8 tests/template_tests/filters.py
  34. +3 −3 tests/test_utils/tests.py
View
10 django/conf/global_settings.py
@@ -198,7 +198,7 @@
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.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.
@@ -211,7 +211,7 @@
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
-# 'django.core.context_processors.request',
+ # 'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
)
@@ -456,8 +456,8 @@
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
-# 'django.middleware.http.ConditionalGetMiddleware',
-# 'django.middleware.gzip.GZipMiddleware',
+ # 'django.middleware.http.ConditionalGetMiddleware',
+ # 'django.middleware.gzip.GZipMiddleware',
)
############
@@ -607,7 +607,7 @@
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
-# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
+ # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
##############
View
5 django/contrib/admin/filters.py
@@ -166,9 +166,8 @@ def __init__(self, field, request, params, model, model_admin, field_path):
rel_name = other_model._meta.pk.name
self.lookup_kwarg = '%s__%s__exact' % (field_path, rel_name)
self.lookup_kwarg_isnull = '%s__isnull' % field_path
- self.lookup_val = request.GET.get(self.lookup_kwarg, None)
- self.lookup_val_isnull = request.GET.get(
- self.lookup_kwarg_isnull, None)
+ self.lookup_val = request.GET.get(self.lookup_kwarg)
+ self.lookup_val_isnull = request.GET.get(self.lookup_kwarg_isnull)
self.lookup_choices = field.get_choices(include_blank=False)
super(RelatedFieldListFilter, self).__init__(
field, request, params, model, model_admin, field_path)
View
14 django/contrib/admin/options.py
@@ -1198,9 +1198,9 @@ def response_delete(self, request, obj_display):
self.message_user(request, _(
'The %(name)s "%(obj)s" was deleted successfully.') % {
- 'name': force_text(opts.verbose_name),
- 'obj': force_text(obj_display)},
- messages.SUCCESS)
+ 'name': force_text(opts.verbose_name),
+ 'obj': force_text(obj_display)
+ }, messages.SUCCESS)
if self.has_change_permission(request, None):
post_url = reverse('admin:%s_%s_changelist' %
@@ -1221,10 +1221,10 @@ def render_delete_form(self, request, context):
return TemplateResponse(request,
self.delete_confirmation_template or [
- "admin/{}/{}/delete_confirmation.html".format(app_label, opts.model_name),
- "admin/{}/delete_confirmation.html".format(app_label),
- "admin/delete_confirmation.html"
- ], context, current_app=self.admin_site.name)
+ "admin/{}/{}/delete_confirmation.html".format(app_label, opts.model_name),
+ "admin/{}/delete_confirmation.html".format(app_label),
+ "admin/delete_confirmation.html"
+ ], context, current_app=self.admin_site.name)
@csrf_protect_m
@transaction.atomic
View
6 django/contrib/admin/views/main.py
@@ -49,9 +49,9 @@ def _is_changelist_popup(request):
IS_LEGACY_POPUP_VAR = 'pop'
if IS_LEGACY_POPUP_VAR in request.GET:
warnings.warn(
- "The `%s` GET parameter has been renamed to `%s`." %
- (IS_LEGACY_POPUP_VAR, IS_POPUP_VAR),
- DeprecationWarning, 2)
+ "The `%s` GET parameter has been renamed to `%s`." %
+ (IS_LEGACY_POPUP_VAR, IS_POPUP_VAR),
+ DeprecationWarning, 2)
return True
return False
View
2  django/contrib/auth/tests/test_forms.py
@@ -106,7 +106,7 @@ def test_invalid_username(self):
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(),
[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):
View
2  django/contrib/auth/tests/test_management.py
@@ -217,7 +217,7 @@ def test_duplicated_permissions(self):
"""
# check duplicated default permission
models.Permission._meta.permissions = [
- ('change_permission', 'Can edit permission (duplicate)')]
+ ('change_permission', 'Can edit permission (duplicate)')]
six.assertRaisesRegex(self, CommandError,
"The permission codename 'change_permission' clashes with a "
"builtin permission for model 'auth.Permission'.",
View
12 django/contrib/formtools/tests/wizard/wizardtests/urls.py
@@ -13,10 +13,10 @@
('form2', Page2),
('form3', Page3),
('form4', Page4)])),
- url(r'^wiz_other_template/$', CookieContactWizard.as_view(
- [('form1', Page1),
- ('form2', Page2),
- ('form3', Page3),
- ('form4', Page4)],
- template_name='other_wizard_form.html')),
+ url(r'^wiz_other_template/$', CookieContactWizard.as_view(
+ [('form1', Page1),
+ ('form2', Page2),
+ ('form3', Page3),
+ ('form4', Page4)],
+ template_name='other_wizard_form.html')),
)
View
4 django/contrib/gis/admin/widgets.py
@@ -36,7 +36,7 @@ def render(self, name, value, attrs=None):
except (GEOSException, ValueError) as err:
logger.error(
"Error creating geometry from value '%s' (%s)" % (
- value, err)
+ value, err)
)
value = None
@@ -68,7 +68,7 @@ def render(self, name, value, attrs=None):
except OGRException as err:
logger.error(
"Error transforming geometry from srid '%s' to srid '%s' (%s)" % (
- value.srid, srid, err)
+ value.srid, srid, err)
)
wkt = ''
else:
View
6 django/contrib/gis/db/models/__init__.py
@@ -9,6 +9,6 @@
# The geographic-enabled fields.
from django.contrib.gis.db.models.fields import (
- GeometryField, PointField, LineStringField, PolygonField,
- MultiPointField, MultiLineStringField, MultiPolygonField,
- GeometryCollectionField)
+ GeometryField, PointField, LineStringField, PolygonField,
+ MultiPointField, MultiLineStringField, MultiPolygonField,
+ GeometryCollectionField)
View
4 django/contrib/gis/forms/widgets.py
@@ -43,7 +43,7 @@ def deserialize(self, value):
except (GEOSException, ValueError) as err:
logger.error(
"Error creating geometry from value '%s' (%s)" % (
- value, err)
+ value, err)
)
return None
@@ -63,7 +63,7 @@ def render(self, name, value, attrs=None):
except gdal.OGRException as err:
logger.error(
"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,
View
2  django/contrib/messages/storage/base.py
@@ -34,7 +34,7 @@ def _prepare(self):
def __eq__(self, other):
return isinstance(other, Message) and self.level == other.level and \
- self.message == other.message
+ self.message == other.message
def __str__(self):
return force_text(self.message)
View
4 django/contrib/messages/tests/base.py
@@ -219,7 +219,7 @@ def test_multiple_posts(self):
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter(
lambda p:'context_processors.messages' not in p,
- settings.TEMPLATE_CONTEXT_PROCESSORS),
+ settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG
)
def test_middleware_disabled(self):
@@ -244,7 +244,7 @@ def test_middleware_disabled(self):
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter(
lambda p:'context_processors.messages' not in p,
- settings.TEMPLATE_CONTEXT_PROCESSORS),
+ settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG
)
def test_middleware_disabled_fail_silently(self):
View
6 django/core/management/validation.py
@@ -251,9 +251,9 @@ def get_validation_errors(outfile, app=None):
"than one foreign key to %s, which is "
"ambiguous and is not permitted." % (
f.rel.through._meta.object_name,
- from_model._meta.object_name
- )
- )
+ from_model._meta.object_name
+ )
+ )
else:
seen_from = True
elif rel_to == to_model:
View
6 django/db/backends/creation.py
@@ -439,9 +439,9 @@ def destroy_test_db(self, old_database_name, verbosity=1):
settings_dict['NAME'] = old_database_name
backend = load_backend(settings_dict['ENGINE'])
new_connection = backend.DatabaseWrapper(
- settings_dict,
- alias='__destroy_test_db__',
- allow_thread_sharing=False)
+ settings_dict,
+ alias='__destroy_test_db__',
+ allow_thread_sharing=False)
new_connection.creation._destroy_test_db(test_database_name, verbosity)
def _destroy_test_db(self, test_database_name, verbosity):
View
4 django/db/models/base.py
@@ -566,8 +566,8 @@ def save(self, force_insert=False, force_update=False, using=None,
deferred_fields = [
f.attname for f in self._meta.fields
if f.attname not in self.__dict__
- and isinstance(self.__class__.__dict__[f.attname],
- DeferredAttribute)]
+ and isinstance(self.__class__.__dict__[f.attname],
+ DeferredAttribute)]
loaded_fields = field_names.difference(deferred_fields)
if loaded_fields:
View
4 django/db/models/fields/__init__.py
@@ -704,7 +704,7 @@ class AutoField(Field):
def __init__(self, *args, **kwargs):
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
Field.__init__(self, *args, **kwargs)
@@ -746,7 +746,7 @@ def get_prep_value(self, value):
def contribute_to_class(self, cls, name):
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)
cls._meta.has_auto_field = True
cls._meta.auto_field = self
View
4 django/db/models/fields/related.py
@@ -1247,8 +1247,8 @@ def validate(self, value, model_instance):
using = router.db_for_read(model_instance.__class__, instance=model_instance)
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)
if not qs.exists():
raise exceptions.ValidationError(
View
2  django/template/base.py
@@ -515,7 +515,7 @@ def next_space_index(subject, i):
'var_chars': "\w\.",
'filter_sep': re.escape(FILTER_SEPARATOR),
'arg_sep': re.escape(FILTER_ARGUMENT_SEPARATOR),
- }
+}
filter_re = re.compile(filter_raw_string, re.UNICODE | re.VERBOSE)
View
11 django/test/testcases.py
@@ -282,8 +282,7 @@ def assertRedirects(self, response, expected_url, status_code=302,
" response code was %d (expected %d)" %
(path, redirect_response.status_code, target_status_code))
- e_scheme, e_netloc, e_path, e_query, e_fragment = urlsplit(
- expected_url)
+ e_scheme, e_netloc, e_path, e_query, e_fragment = urlsplit(expected_url)
if not (e_scheme or e_netloc):
expected_url = urlunsplit(('http', host or 'testserver', e_path,
e_query, e_fragment))
@@ -850,10 +849,10 @@ def _fixture_setup(self):
try:
call_command('loaddata', *self.fixtures,
**{
- 'verbosity': 0,
- 'commit': False,
- 'database': db_name,
- 'skip_validation': True,
+ 'verbosity': 0,
+ 'commit': False,
+ 'database': db_name,
+ 'skip_validation': True,
})
except Exception:
self._fixture_teardown()
View
4 django/utils/jslex.py
@@ -145,12 +145,12 @@ class JsLexer(Lexer):
states = {
'div': # slash will mean division
both_before + [
- Tok("punct", literals("/= /"), next='reg'),
+ Tok("punct", literals("/= /"), next='reg'),
] + both_after,
'reg': # slash will mean regex
both_before + [
- Tok("regex",
+ Tok("regex",
r"""
/ # opening slash
# First character is..
View
5 django/views/decorators/debug.py
@@ -65,8 +65,9 @@ def decorator(view):
@functools.wraps(view)
def sensitive_post_parameters_wrapper(request, *args, **kwargs):
assert isinstance(request, HttpRequest), (
- "sensitive_post_parameters didn't receive an HttpRequest. If you "
- "are decorating a classmethod, be sure to use @method_decorator."
+ "sensitive_post_parameters didn't receive an HttpRequest. "
+ "If you are decorating a classmethod, be sure to use "
+ "@method_decorator."
)
if parameters:
request.sensitive_post_parameters = parameters
View
4 docs/conf.py
@@ -226,8 +226,8 @@ def django_release():
# (source start file, target name, title, author, document class [howto/manual]).
#latex_documents = []
latex_documents = [
- ('contents', 'django.tex', 'Django Documentation',
- 'Django Software Foundation', 'manual'),
+ ('contents', 'django.tex', 'Django Documentation',
+ 'Django Software Foundation', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
View
2  setup.cfg
@@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
[flake8]
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]
license-file = LICENSE
View
8 tests/bulk_create/tests.py
@@ -94,8 +94,8 @@ def test_large_batch(self):
with override_settings(DEBUG=True):
connection.queries = []
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.filter(f1__gte=450, f1__lte=550).count(),
@@ -115,8 +115,8 @@ def test_large_batch_efficiency(self):
with override_settings(DEBUG=True):
connection.queries = []
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)
def test_large_batch_mixed(self):
View
2  tests/cache/tests.py
@@ -867,7 +867,7 @@ def test_zero_cull(self):
def test_second_call_doesnt_crash(self):
stdout = six.StringIO()
management.call_command(
- 'createcachetable',
+ 'createcachetable',
stdout=stdout
)
self.assertEqual(stdout.getvalue(),
View
4 tests/extra_regress/tests.py
@@ -306,14 +306,14 @@ def test_regression_10847(self):
self.assertQuerysetEqual(
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>']
)
self.assertQuerysetEqual(
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>']
)
View
92 tests/forms_tests/tests/test_media.py
@@ -23,7 +23,7 @@ def test_construction(self):
class Foo:
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')
@@ -52,7 +52,7 @@ def test_media_dsl(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -77,21 +77,21 @@ def test_combine_media(self):
class MyWidget1(TextInput):
class Media:
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')
class MyWidget2(TextInput):
class Media:
css = {
- 'all': ('/path/to/css2','/path/to/css3')
+ 'all': ('/path/to/css2','/path/to/css3')
}
js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput):
class Media:
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -158,7 +158,7 @@ def test_media_property_parent_references(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -185,7 +185,7 @@ def test_media_inheritance(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -203,7 +203,7 @@ class MyWidget7(MyWidget1):
class MyWidget8(MyWidget1):
class Media:
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -222,7 +222,7 @@ def test_media_inheritance_from_property(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -249,7 +249,7 @@ class MyWidget10(MyWidget1):
class Media:
extend = False
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -264,7 +264,7 @@ def test_media_inheritance_extends(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -272,7 +272,7 @@ class MyWidget11(MyWidget1):
class Media:
extend = True
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -290,7 +290,7 @@ def test_media_inheritance_single_type(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -298,7 +298,7 @@ class MyWidget12(MyWidget1):
class Media:
extend = ('css',)
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -318,9 +318,9 @@ def test_multi_media(self):
class MultimediaWidget(TextInput):
class Media:
css = {
- 'screen, print': ('/file1','/file2'),
- 'screen': ('/file3',),
- 'print': ('/file4',)
+ 'screen, print': ('/file1','/file2'),
+ 'screen': ('/file3',),
+ 'print': ('/file4',)
}
js = ('/path/to/js1','/path/to/js4')
@@ -340,21 +340,21 @@ def test_multi_widget(self):
class MyWidget1(TextInput):
class Media:
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')
class MyWidget2(TextInput):
class Media:
css = {
- 'all': ('/path/to/css2','/path/to/css3')
+ 'all': ('/path/to/css2','/path/to/css3')
}
js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput):
class Media:
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -382,21 +382,21 @@ def test_form_media(self):
class MyWidget1(TextInput):
class Media:
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')
class MyWidget2(TextInput):
class Media:
css = {
- 'all': ('/path/to/css2','/path/to/css3')
+ 'all': ('/path/to/css2','/path/to/css3')
}
js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput):
class Media:
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -474,7 +474,7 @@ def test_construction(self):
class Foo:
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')
@@ -503,7 +503,7 @@ def test_media_dsl(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -528,21 +528,21 @@ def test_combine_media(self):
class MyWidget1(TextInput):
class Media:
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')
class MyWidget2(TextInput):
class Media:
css = {
- 'all': ('/path/to/css2','/path/to/css3')
+ 'all': ('/path/to/css2','/path/to/css3')
}
js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput):
class Media:
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -609,7 +609,7 @@ def test_media_property_parent_references(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -636,7 +636,7 @@ def test_media_inheritance(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -654,7 +654,7 @@ class MyWidget7(MyWidget1):
class MyWidget8(MyWidget1):
class Media:
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -673,7 +673,7 @@ def test_media_inheritance_from_property(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -700,7 +700,7 @@ class MyWidget10(MyWidget1):
class Media:
extend = False
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -715,7 +715,7 @@ def test_media_inheritance_extends(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -723,7 +723,7 @@ class MyWidget11(MyWidget1):
class Media:
extend = True
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -741,7 +741,7 @@ def test_media_inheritance_single_type(self):
class MyWidget1(TextInput):
class Media:
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')
@@ -749,7 +749,7 @@ class MyWidget12(MyWidget1):
class Media:
extend = ('css',)
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -769,9 +769,9 @@ def test_multi_media(self):
class MultimediaWidget(TextInput):
class Media:
css = {
- 'screen, print': ('/file1','/file2'),
- 'screen': ('/file3',),
- 'print': ('/file4',)
+ 'screen, print': ('/file1','/file2'),
+ 'screen': ('/file3',),
+ 'print': ('/file4',)
}
js = ('/path/to/js1','/path/to/js4')
@@ -791,21 +791,21 @@ def test_multi_widget(self):
class MyWidget1(TextInput):
class Media:
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')
class MyWidget2(TextInput):
class Media:
css = {
- 'all': ('/path/to/css2','/path/to/css3')
+ 'all': ('/path/to/css2','/path/to/css3')
}
js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput):
class Media:
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
@@ -833,21 +833,21 @@ def test_form_media(self):
class MyWidget1(TextInput):
class Media:
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')
class MyWidget2(TextInput):
class Media:
css = {
- 'all': ('/path/to/css2','/path/to/css3')
+ 'all': ('/path/to/css2','/path/to/css3')
}
js = ('/path/to/js1','/path/to/js4')
class MyWidget3(TextInput):
class Media:
css = {
- 'all': ('/path/to/css3','path/to/css1')
+ 'all': ('/path/to/css3','path/to/css1')
}
js = ('/path/to/js1','/path/to/js4')
View
2  tests/model_regress/tests.py
@@ -131,7 +131,7 @@ def test_date_lookup(self):
datetime.date(1, 3, 3),
],
attrgetter("when")
- )
+ )
if (3,) <= sys.version_info < (3, 3) and connection.vendor == 'mysql':
# In Python < 3.3, datetime.strftime raises an exception for years
View
6 tests/prefetch_related/tests.py
@@ -440,9 +440,9 @@ def test_m2m(self):
with self.assertNumQueries(3):
qs = Author.objects.all().prefetch_related('favorite_authors', 'favors_me')
favorites = [(
- [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()]
- ) for author in qs]
+ [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()]
+ ) for author in qs]
self.assertEqual(
favorites,
[
View
6 tests/serializers/tests.py
@@ -246,9 +246,9 @@ def test_pre_1000ad_date(self):
# Regression for #12524 -- dates before 1000AD get prefixed
# 0's on the year
a = Article.objects.create(
- author = self.jane,
- headline = "Nobody remembers the early years",
- pub_date = datetime(1, 2, 3, 4, 5, 6))
+ author = self.jane,
+ headline = "Nobody remembers the early years",
+ pub_date = datetime(1, 2, 3, 4, 5, 6))
serial_str = serializers.serialize(self.serializer_name, [a])
date_values = self._get_field_values(serial_str, "pub_date")
View
28 tests/serializers_regress/tests.py
@@ -121,13 +121,13 @@ def data_compare(testcase, pk, klass, data):
if klass == BinaryData and data is not None:
testcase.assertEqual(bytes(data), bytes(instance.data),
"Objects with PK=%d not equal; expected '%s' (%s), got '%s' (%s)" % (
- pk, repr(bytes(data)), type(data), repr(bytes(instance.data)),
- type(instance.data))
+ pk, repr(bytes(data)), type(data), repr(bytes(instance.data)),
+ type(instance.data))
)
else:
testcase.assertEqual(data, instance.data,
"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):
@@ -205,7 +205,7 @@ def inherited_compare(testcase, pk, klass, data):
(data_obj, 41, EmailData, None),
(data_obj, 42, EmailData, ""),
(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, 60, FilePathData, "/foo/bar/whiz.txt"),
(data_obj, 61, FilePathData, None),
@@ -308,10 +308,10 @@ def inherited_compare(testcase, pk, klass, data):
(pk_obj, 601, BooleanPKData, True),
(pk_obj, 602, BooleanPKData, False),
(pk_obj, 610, CharPKData, "Test Char PKData"),
-# (pk_obj, 620, DatePKData, datetime.date(2006,6,16)),
-# (pk_obj, 630, DateTimePKData, datetime.datetime(2006,6,16,10,42,37)),
+ # (pk_obj, 620, DatePKData, datetime.date(2006,6,16)),
+ # (pk_obj, 630, DateTimePKData, datetime.datetime(2006,6,16,10,42,37)),
(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, 670, DecimalPKData, decimal.Decimal('12.345')),
(pk_obj, 671, DecimalPKData, decimal.Decimal('-12.345')),
@@ -322,7 +322,7 @@ def inherited_compare(testcase, pk, klass, data):
(pk_obj, 680, IntegerPKData, 123456789),
(pk_obj, 681, IntegerPKData, -123456789),
(pk_obj, 682, IntegerPKData, 0),
-# (XX, ImagePKData
+ # (XX, ImagePKData
(pk_obj, 690, IPAddressPKData, "127.0.0.1"),
(pk_obj, 695, GenericIPAddressPKData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"),
# (pk_obj, 700, NullBooleanPKData, True),
@@ -333,12 +333,12 @@ def inherited_compare(testcase, pk, klass, data):
(pk_obj, 750, SmallPKData, 12),
(pk_obj, 751, SmallPKData, -12),
(pk_obj, 752, SmallPKData, 0),
-# (pk_obj, 760, TextPKData, """This is a long piece of text.
-# It contains line breaks.
-# Several of them.
-# The end."""),
-# (pk_obj, 770, TimePKData, datetime.time(10,42,37)),
-# (pk_obj, 790, XMLPKData, "<foo></foo>"),
+ # (pk_obj, 760, TextPKData, """This is a long piece of text.
+ # It contains line breaks.
+ # Several of them.
+ # The end."""),
+ # (pk_obj, 770, TimePKData, datetime.time(10,42,37)),
+ # (pk_obj, 790, XMLPKData, "<foo></foo>"),
(data_obj, 800, AutoNowDateTimeData, datetime.datetime(2006,6,16,10,42,37)),
(data_obj, 810, ModifyingSaveData, 42),
View
6 tests/signals_regress/tests.py
@@ -45,9 +45,9 @@ def setUp(self):
# 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)
self.pre_signals = (len(models.signals.pre_save.receivers),
- len(models.signals.post_save.receivers),
- len(models.signals.pre_delete.receivers),
- len(models.signals.post_delete.receivers))
+ len(models.signals.post_save.receivers),
+ len(models.signals.pre_delete.receivers),
+ len(models.signals.post_delete.receivers))
models.signals.pre_save.connect(self.pre_save_test)
models.signals.post_save.connect(self.post_save_test)
View
16 tests/template_tests/filters.py
@@ -371,12 +371,12 @@ def get_filter_tests():
'time05': (r'{{ d|time:"P:e:O:T:Z" }}', {'d': today}, ''),
'time06': (r'{{ obj|time:"P:e:O:T:Z" }}', {'obj': 'non-datetime-value'}, ''),
- # Tests for #11687 and #16676
- 'add01': (r'{{ i|add:"5" }}', {'i': 2000}, '2005'),
- 'add02': (r'{{ i|add:"napis" }}', {'i': 2000}, ''),
- 'add03': (r'{{ i|add:16 }}', {'i': 'not_an_int'}, ''),
- '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]'),
- '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'),
+ # Tests for #11687 and #16676
+ 'add01': (r'{{ i|add:"5" }}', {'i': 2000}, '2005'),
+ 'add02': (r'{{ i|add:"napis" }}', {'i': 2000}, ''),
+ 'add03': (r'{{ i|add:16 }}', {'i': 'not_an_int'}, ''),
+ '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]'),
+ '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'),
}
View
6 tests/test_utils/tests.py
@@ -397,13 +397,13 @@ def test_attributes(self):
def test_complex_examples(self):
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>
<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>
<tr><th><label for="id_birthday">Birthday:</label></th>
<td><input type="text" value="1940-10-9" name="birthday" id="id_birthday" /></td></tr>""",
- """
+ """
<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>
@@ -416,7 +416,7 @@ def test_complex_examples(self):
""")
self.assertHTMLEqual(
- """<!DOCTYPE html>
+ """<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet">
Please sign in to comment.
Something went wrong with that request. Please try again.