Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #21288 -- Fixed E126 pep8 warnings

  • Loading branch information...
commit b289fcf1bfeaa717ed465b2529a275b61dc02d92 1 parent a369016
@alasdairnicol alasdairnicol authored timgraham committed
Showing with 647 additions and 635 deletions.
  1. +6 −6 django/contrib/admin/filters.py
  2. +11 −12 django/contrib/admin/options.py
  3. +3 −5 django/contrib/admin/templatetags/admin_list.py
  4. +1 −2  django/contrib/admin/templatetags/admin_modify.py
  5. +1 −1  django/contrib/auth/management/commands/changepassword.py
  6. +1 −1  django/contrib/auth/tests/test_auth_backends.py
  7. +11 −9 django/contrib/auth/tests/test_views.py
  8. +5 −8 django/contrib/contenttypes/generic.py
  9. +40 −40 django/contrib/flatpages/tests/test_templatetags.py
  10. +4 −4 django/contrib/formtools/wizard/storage/base.py
  11. +2 −2 django/contrib/formtools/wizard/views.py
  12. +9 −9 django/contrib/gis/db/models/sql/query.py
  13. +1 −1  django/contrib/gis/db/models/sql/where.py
  14. +1 −1  django/contrib/gis/gdal/geometries.py
  15. +6 −5 django/contrib/gis/geos/tests/test_geos_mutation.py
  16. +5 −5 django/contrib/messages/tests/base.py
  17. +2 −2 django/contrib/redirects/tests.py
  18. +1 −1  django/contrib/sitemaps/views.py
  19. +4 −4 django/core/handlers/base.py
  20. +1 −1  django/core/management/commands/createcachetable.py
  21. +10 −10 django/core/management/commands/loaddata.py
  22. +1 −1  django/core/management/commands/makemessages.py
  23. +4 −4 django/core/serializers/xml_serializer.py
  24. +17 −13 django/db/models/base.py
  25. +1 −1  django/db/models/query.py
  26. +2 −2 django/db/models/sql/query.py
  27. +1 −1  django/db/models/sql/subqueries.py
  28. +2 −2 django/db/transaction.py
  29. +3 −3 django/forms/models.py
  30. +3 −3 django/forms/widgets.py
  31. +2 −2 django/http/utils.py
  32. +1 −1  django/middleware/locale.py
  33. +1 −1  django/test/runner.py
  34. +1 −1  django/test/testcases.py
  35. +2 −2 django/utils/html.py
  36. +2 −2 django/utils/http.py
  37. +9 −9 django/utils/jslex.py
  38. +1 −1  django/utils/timezone.py
  39. +1 −1  django/views/generic/dates.py
  40. +2 −2 django/views/generic/list.py
  41. +2 −2 docs/_ext/applyxrefs.py
  42. +1 −1  setup.cfg
  43. +5 −6 tests/admin_views/models.py
  44. +5 −7 tests/admin_views/tests.py
  45. +6 −2 tests/admin_widgets/tests.py
  46. +2 −4 tests/basic/tests.py
  47. +59 −59 tests/cache/tests.py
  48. +1 −2  tests/distinct_on_fields/tests.py
  49. +15 −16 tests/extra_regress/tests.py
  50. +1 −2  tests/file_uploads/tests.py
  51. +26 −26 tests/forms_tests/tests/test_fields.py
  52. +6 −6 tests/forms_tests/tests/test_widgets.py
  53. +4 −4 tests/forms_tests/tests/tests.py
  54. +21 −21 tests/generic_relations/tests.py
  55. +2 −2 tests/i18n/tests.py
  56. +13 −13 tests/logging_tests/tests.py
  57. +2 −2 tests/mail/tests.py
  58. +8 −8 tests/managers_regress/tests.py
  59. +5 −5 tests/many_to_one/tests.py
  60. +5 −5 tests/middleware_exceptions/tests.py
  61. +6 −6 tests/model_fields/models.py
  62. +65 −65 tests/model_forms/tests.py
  63. +17 −17 tests/model_formsets_regress/tests.py
  64. +2 −2 tests/model_inheritance_regress/models.py
  65. +2 −2 tests/model_inheritance_regress/tests.py
  66. +8 −8 tests/model_regress/tests.py
  67. +5 −5 tests/null_queries/tests.py
  68. +11 −11 tests/pagination/tests.py
  69. +1 −1  tests/queries/tests.py
  70. +24 −24 tests/requests/tests.py
  71. +2 −2 tests/reverse_single_related/tests.py
  72. +2 −2 tests/select_related_regress/tests.py
  73. +2 −4 tests/serializers_regress/tests.py
  74. +2 −2 tests/signing/tests.py
  75. +1 −1  tests/template_tests/test_loaders.py
  76. +8 −8 tests/template_tests/test_response.py
  77. +4 −4 tests/test_client_regress/tests.py
  78. +108 −90 tests/timezones/tests.py
  79. +1 −1  tests/transactions/tests.py
  80. +6 −6 tests/utils_tests/test_tzinfo.py
View
12 django/contrib/admin/filters.py
@@ -217,8 +217,8 @@ def choices(self, cl):
}
FieldListFilter.register(lambda f: (
- bool(f.rel) if hasattr(f, 'rel') else
- isinstance(f, models.related.RelatedObject)), RelatedFieldListFilter)
+ bool(f.rel) if hasattr(f, 'rel') else
+ isinstance(f, models.related.RelatedObject)), RelatedFieldListFilter)
class BooleanFieldListFilter(FieldListFilter):
@@ -241,7 +241,7 @@ def choices(self, cl):
yield {
'selected': self.lookup_val == lookup and not self.lookup_val2,
'query_string': cl.get_query_string({
- self.lookup_kwarg: lookup,
+ self.lookup_kwarg: lookup,
}, [self.lookup_kwarg2]),
'display': title,
}
@@ -249,7 +249,7 @@ def choices(self, cl):
yield {
'selected': self.lookup_val2 == 'True',
'query_string': cl.get_query_string({
- self.lookup_kwarg2: 'True',
+ self.lookup_kwarg2: 'True',
}, [self.lookup_kwarg]),
'display': _('Unknown'),
}
@@ -278,7 +278,7 @@ def choices(self, cl):
yield {
'selected': smart_text(lookup) == self.lookup_val,
'query_string': cl.get_query_string({
- self.lookup_kwarg: lookup}),
+ self.lookup_kwarg: lookup}),
'display': title,
}
@@ -340,7 +340,7 @@ def choices(self, cl):
yield {
'selected': self.date_params == param_dict,
'query_string': cl.get_query_string(
- param_dict, [self.field_generic]),
+ param_dict, [self.field_generic]),
'display': title,
}
View
23 django/contrib/admin/options.py
@@ -150,13 +150,12 @@ def formfield_for_dbfield(self, db_field, **kwargs):
# rendered output. formfield can be None if it came from a
# OneToOneField with parent_link=True or a M2M intermediary.
if formfield and db_field.name not in self.raw_id_fields:
- related_modeladmin = self.admin_site._registry.get(
- db_field.rel.to)
+ related_modeladmin = self.admin_site._registry.get(db_field.rel.to)
can_add_related = bool(related_modeladmin and
- related_modeladmin.has_add_permission(request))
+ related_modeladmin.has_add_permission(request))
formfield.widget = widgets.RelatedFieldWidgetWrapper(
- formfield.widget, db_field.rel, self.admin_site,
- can_add_related=can_add_related)
+ formfield.widget, db_field.rel, self.admin_site,
+ can_add_related=can_add_related)
return formfield
@@ -1196,11 +1195,11 @@ def response_delete(self, request, obj_display):
opts = self.model._meta
- self.message_user(request, _(
- 'The %(name)s "%(obj)s" was deleted successfully.') % {
+ 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)
+ }, messages.SUCCESS)
if self.has_change_permission(request, None):
post_url = reverse('admin:%s_%s_changelist' %
@@ -1313,9 +1312,9 @@ def change_view(self, request, object_id, form_url='', extra_context=None):
raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_text(opts.verbose_name), 'key': escape(object_id)})
if request.method == 'POST' and "_saveasnew" in request.POST:
- return self.add_view(request, form_url=reverse('admin:%s_%s_add' %
- (opts.app_label, opts.model_name),
- current_app=self.admin_site.name))
+ return self.add_view(request, form_url=reverse('admin:%s_%s_add' % (
+ opts.app_label, opts.model_name),
+ current_app=self.admin_site.name))
ModelForm = self.get_form(request, obj)
if request.method == 'POST':
@@ -1544,7 +1543,7 @@ def delete_view(self, request, object_id, extra_context=None):
if obj is None:
raise Http404(
_('%(name)s object with primary key %(key)r does not exist.') %
- {'name': force_text(opts.verbose_name), 'key': escape(object_id)}
+ {'name': force_text(opts.verbose_name), 'key': escape(object_id)}
)
using = router.db_for_write(self.model)
View
8 django/contrib/admin/templatetags/admin_list.py
@@ -164,8 +164,7 @@ def result_headers(cl):
"url_primary": cl.get_query_string({ORDER_VAR: '.'.join(o_list_primary)}),
"url_remove": cl.get_query_string({ORDER_VAR: '.'.join(o_list_remove)}),
"url_toggle": cl.get_query_string({ORDER_VAR: '.'.join(o_list_toggle)}),
- "class_attrib": format_html(' class="{0}"', ' '.join(th_classes))
- if th_classes else '',
+ "class_attrib": format_html(' class="{0}"', ' '.join(th_classes)) if th_classes else '',
}
def _boolean_icon(field_val):
@@ -246,8 +245,7 @@ def link_in_col(is_first, field_name, cl):
link_or_text = format_html(
'<a href="{0}"{1}>{2}</a>',
url,
- format_html(' onclick="opener.dismissRelatedLookupPopup(window, &#39;{0}&#39;); return false;"', result_id)
- if cl.is_popup else '',
+ format_html(' onclick="opener.dismissRelatedLookupPopup(window, &#39;{0}&#39;); return false;"', result_id) if cl.is_popup else '',
result_repr)
yield format_html('<{0}{1}>{2}</{3}>',
@@ -261,7 +259,7 @@ def link_in_col(is_first, field_name, cl):
# can provide fields on a per request basis
if (form and field_name in form.fields and not (
field_name == cl.model._meta.pk.name and
- form[cl.model._meta.pk.name].is_hidden)):
+ form[cl.model._meta.pk.name].is_hidden)):
bf = form[field_name]
result_repr = mark_safe(force_text(bf.errors) + force_text(bf))
yield format_html('<td{0}>{1}</td>', row_class, result_repr)
View
3  django/contrib/admin/templatetags/admin_modify.py
@@ -33,8 +33,7 @@ def submit_row(context):
'show_delete_link': (not is_popup and context['has_delete_permission']
and change and context.get('show_delete', True)),
'show_save_as_new': not is_popup and change and save_as,
- 'show_save_and_add_another': context['has_add_permission'] and
- not is_popup and (not save_as or context['add']),
+ 'show_save_and_add_another': context['has_add_permission'] and not is_popup and (not save_as or context['add']),
'show_save_and_continue': not is_popup and context['has_change_permission'],
'is_popup': is_popup,
'show_save': True,
View
2  django/contrib/auth/management/commands/changepassword.py
@@ -34,7 +34,7 @@ def handle(self, *args, **options):
try:
u = UserModel._default_manager.using(options.get('database')).get(**{
- UserModel.USERNAME_FIELD: username
+ UserModel.USERNAME_FIELD: username
})
except UserModel.DoesNotExist:
raise CommandError("user '%s' does not exist" % username)
View
2  django/contrib/auth/tests/test_auth_backends.py
@@ -427,7 +427,7 @@ def test_permission_denied(self):
self.assertEqual(authenticate(username='test', password='test'), None)
@override_settings(AUTHENTICATION_BACKENDS=tuple(
- settings.AUTHENTICATION_BACKENDS) + (backend, ))
+ settings.AUTHENTICATION_BACKENDS) + (backend, ))
def test_authenticates(self):
self.assertEqual(authenticate(username='test', password='test'), self.user1)
View
20 django/contrib/auth/tests/test_views.py
@@ -177,9 +177,10 @@ def test_poisoned_http_host(self):
# HTTP_HOST header isn't poisoned. This is done as a check when get_host()
# is invoked, but we check here as a practical consequence.
with patch_logger('django.security.DisallowedHost', 'error') as logger_calls:
- response = self.client.post('/password_reset/',
- {'email': 'staffmember@example.com'},
- HTTP_HOST='www.example:dr.frankenstein@evil.tld'
+ response = self.client.post(
+ '/password_reset/',
+ {'email': 'staffmember@example.com'},
+ HTTP_HOST='www.example:dr.frankenstein@evil.tld'
)
self.assertEqual(response.status_code, 400)
self.assertEqual(len(mail.outbox), 0)
@@ -190,9 +191,10 @@ def test_poisoned_http_host(self):
def test_poisoned_http_host_admin_site(self):
"Poisoned HTTP_HOST headers can't be used for reset emails on admin views"
with patch_logger('django.security.DisallowedHost', 'error') as logger_calls:
- response = self.client.post('/admin_password_reset/',
- {'email': 'staffmember@example.com'},
- HTTP_HOST='www.example:dr.frankenstein@evil.tld'
+ response = self.client.post(
+ '/admin_password_reset/',
+ {'email': 'staffmember@example.com'},
+ HTTP_HOST='www.example:dr.frankenstein@evil.tld'
)
self.assertEqual(response.status_code, 400)
self.assertEqual(len(mail.outbox), 0)
@@ -356,7 +358,7 @@ def fail_login(self, password='password'):
'password': password,
})
self.assertFormError(response, AuthenticationForm.error_messages['invalid_login'] % {
- 'username': User._meta.get_field('username').verbose_name
+ 'username': User._meta.get_field('username').verbose_name
})
def logout(self):
@@ -490,8 +492,8 @@ def test_security_check(self, password='password'):
'good_url': urlquote(good_url),
}
response = self.client.post(safe_url, {
- 'username': 'testclient',
- 'password': password,
+ 'username': 'testclient',
+ 'password': password,
})
self.assertEqual(response.status_code, 302)
self.assertTrue(good_url in response.url,
View
13 django/contrib/contenttypes/generic.py
@@ -240,12 +240,10 @@ def bulk_related_objects(self, objs, using=DEFAULT_DB_ALIAS):
"""
return self.rel.to._base_manager.db_manager(using).filter(**{
- "%s__pk" % self.content_type_field_name:
- ContentType.objects.db_manager(using).get_for_model(
- self.model, for_concrete_model=self.for_concrete_model).pk,
- "%s__in" % self.object_id_field_name:
- [obj.pk for obj in objs]
- })
+ "%s__pk" % self.content_type_field_name: ContentType.objects.db_manager(using).get_for_model(
+ self.model, for_concrete_model=self.for_concrete_model).pk,
+ "%s__in" % self.object_id_field_name: [obj.pk for obj in objs]
+ })
class ReverseGenericRelatedObjectsDescriptor(object):
@@ -352,8 +350,7 @@ def get_prefetch_queryset(self, instances):
db = self._db or router.db_for_read(self.model, instance=instances[0])
query = {
'%s__pk' % self.content_type_field_name: self.content_type.id,
- '%s__in' % self.object_id_field_name:
- set(obj._get_pk_val() for obj in instances)
+ '%s__in' % self.object_id_field_name: set(obj._get_pk_val() for obj in instances)
}
qs = super(GenericRelatedObjectManager, self).get_queryset().using(db).filter(**query)
# We (possibly) need to convert object IDs to the type of the
View
80 django/contrib/flatpages/tests/test_templatetags.py
@@ -27,24 +27,24 @@ class FlatpageTemplateTagTests(TestCase):
def test_get_flatpages_tag(self):
"The flatpage template tag retrives unregistered prefixed flatpages by default"
out = Template(
- "{% load flatpages %}"
- "{% get_flatpages as flatpages %}"
- "{% for page in flatpages %}"
- "{{ page.title }},"
- "{% endfor %}"
+ "{% load flatpages %}"
+ "{% get_flatpages as flatpages %}"
+ "{% for page in flatpages %}"
+ "{{ page.title }},"
+ "{% endfor %}"
).render(Context())
self.assertEqual(out, "A Flatpage,A Nested Flatpage,")
def test_get_flatpages_tag_for_anon_user(self):
"The flatpage template tag retrives unregistered flatpages for an anonymous user"
out = Template(
- "{% load flatpages %}"
- "{% get_flatpages for anonuser as flatpages %}"
- "{% for page in flatpages %}"
- "{{ page.title }},"
- "{% endfor %}"
+ "{% load flatpages %}"
+ "{% get_flatpages for anonuser as flatpages %}"
+ "{% for page in flatpages %}"
+ "{{ page.title }},"
+ "{% endfor %}"
).render(Context({
- 'anonuser': AnonymousUser()
+ 'anonuser': AnonymousUser()
}))
self.assertEqual(out, "A Flatpage,A Nested Flatpage,")
@@ -53,37 +53,37 @@ def test_get_flatpages_tag_for_user(self):
"The flatpage template tag retrives all flatpages for an authenticated user"
me = User.objects.create_user('testuser', 'test@example.com', 's3krit')
out = Template(
- "{% load flatpages %}"
- "{% get_flatpages for me as flatpages %}"
- "{% for page in flatpages %}"
- "{{ page.title }},"
- "{% endfor %}"
+ "{% load flatpages %}"
+ "{% get_flatpages for me as flatpages %}"
+ "{% for page in flatpages %}"
+ "{{ page.title }},"
+ "{% endfor %}"
).render(Context({
- 'me': me
+ 'me': me
}))
self.assertEqual(out, "A Flatpage,A Nested Flatpage,Sekrit Nested Flatpage,Sekrit Flatpage,")
def test_get_flatpages_with_prefix(self):
"The flatpage template tag retrives unregistered prefixed flatpages by default"
out = Template(
- "{% load flatpages %}"
- "{% get_flatpages '/location/' as location_flatpages %}"
- "{% for page in location_flatpages %}"
- "{{ page.title }},"
- "{% endfor %}"
+ "{% load flatpages %}"
+ "{% get_flatpages '/location/' as location_flatpages %}"
+ "{% for page in location_flatpages %}"
+ "{{ page.title }},"
+ "{% endfor %}"
).render(Context())
self.assertEqual(out, "A Nested Flatpage,")
def test_get_flatpages_with_prefix_for_anon_user(self):
"The flatpage template tag retrives unregistered prefixed flatpages for an anonymous user"
out = Template(
- "{% load flatpages %}"
- "{% get_flatpages '/location/' for anonuser as location_flatpages %}"
- "{% for page in location_flatpages %}"
- "{{ page.title }},"
- "{% endfor %}"
+ "{% load flatpages %}"
+ "{% get_flatpages '/location/' for anonuser as location_flatpages %}"
+ "{% for page in location_flatpages %}"
+ "{{ page.title }},"
+ "{% endfor %}"
).render(Context({
- 'anonuser': AnonymousUser()
+ 'anonuser': AnonymousUser()
}))
self.assertEqual(out, "A Nested Flatpage,")
@@ -92,26 +92,26 @@ def test_get_flatpages_with_prefix_for_user(self):
"The flatpage template tag retrive prefixed flatpages for an authenticated user"
me = User.objects.create_user('testuser', 'test@example.com', 's3krit')
out = Template(
- "{% load flatpages %}"
- "{% get_flatpages '/location/' for me as location_flatpages %}"
- "{% for page in location_flatpages %}"
- "{{ page.title }},"
- "{% endfor %}"
+ "{% load flatpages %}"
+ "{% get_flatpages '/location/' for me as location_flatpages %}"
+ "{% for page in location_flatpages %}"
+ "{{ page.title }},"
+ "{% endfor %}"
).render(Context({
- 'me': me
+ 'me': me
}))
self.assertEqual(out, "A Nested Flatpage,Sekrit Nested Flatpage,")
def test_get_flatpages_with_variable_prefix(self):
"The prefix for the flatpage template tag can be a template variable"
out = Template(
- "{% load flatpages %}"
- "{% get_flatpages location_prefix as location_flatpages %}"
- "{% for page in location_flatpages %}"
- "{{ page.title }},"
- "{% endfor %}"
+ "{% load flatpages %}"
+ "{% get_flatpages location_prefix as location_flatpages %}"
+ "{% for page in location_flatpages %}"
+ "{{ page.title }},"
+ "{% endfor %}"
).render(Context({
- 'location_prefix': '/location/'
+ 'location_prefix': '/location/'
}))
self.assertEqual(out, "A Nested Flatpage,")
View
8 django/contrib/formtools/wizard/storage/base.py
@@ -70,8 +70,8 @@ def get_step_files(self, step):
if wizard_files and not self.file_storage:
raise NoFileStorageConfigured(
- "You need to define 'file_storage' in your "
- "wizard view in order to handle file uploads.")
+ "You need to define 'file_storage' in your "
+ "wizard view in order to handle file uploads.")
files = {}
for field, field_dict in six.iteritems(wizard_files):
@@ -84,8 +84,8 @@ def get_step_files(self, step):
def set_step_files(self, step, files):
if files and not self.file_storage:
raise NoFileStorageConfigured(
- "You need to define 'file_storage' in your "
- "wizard view in order to handle file uploads.")
+ "You need to define 'file_storage' in your "
+ "wizard view in order to handle file uploads.")
if step not in self.data[self.step_files_key]:
self.data[self.step_files_key][step] = {}
View
4 django/contrib/formtools/wizard/views.py
@@ -184,8 +184,8 @@ def get_initkwargs(cls, form_list=None, initial_dict=None,
if (isinstance(field, forms.FileField) and
not hasattr(cls, 'file_storage')):
raise NoFileStorageConfigured(
- "You need to define 'file_storage' in your "
- "wizard view in order to handle file uploads.")
+ "You need to define 'file_storage' in your "
+ "wizard view in order to handle file uploads.")
# build the kwargs for the wizardview instances
kwargs['form_list'] = computed_form_list
View
18 django/contrib/gis/db/models/sql/query.py
@@ -10,15 +10,15 @@
ALL_TERMS = set([
- 'bbcontains', 'bboverlaps', 'contained', 'contains',
- 'contains_properly', 'coveredby', 'covers', 'crosses', 'disjoint',
- 'distance_gt', 'distance_gte', 'distance_lt', 'distance_lte',
- 'dwithin', 'equals', 'exact',
- 'intersects', 'overlaps', 'relate', 'same_as', 'touches', 'within',
- 'left', 'right', 'overlaps_left', 'overlaps_right',
- 'overlaps_above', 'overlaps_below',
- 'strictly_above', 'strictly_below'
- ])
+ 'bbcontains', 'bboverlaps', 'contained', 'contains',
+ 'contains_properly', 'coveredby', 'covers', 'crosses', 'disjoint',
+ 'distance_gt', 'distance_gte', 'distance_lt', 'distance_lte',
+ 'dwithin', 'equals', 'exact',
+ 'intersects', 'overlaps', 'relate', 'same_as', 'touches', 'within',
+ 'left', 'right', 'overlaps_left', 'overlaps_right',
+ 'overlaps_above', 'overlaps_below',
+ 'strictly_above', 'strictly_below'
+])
ALL_TERMS.update(sql.constants.QUERY_TERMS)
class GeoQuery(sql.Query):
View
2  django/contrib/gis/db/models/sql/where.py
@@ -46,7 +46,7 @@ def make_atom(self, child, qn, connection):
if isinstance(lvalue, GeoConstraint):
data, params = lvalue.process(lookup_type, params_or_value, connection)
spatial_sql, spatial_params = connection.ops.spatial_lookup_sql(
- data, lookup_type, params_or_value, lvalue.field, qn)
+ data, lookup_type, params_or_value, lvalue.field, qn)
return spatial_sql, spatial_params + params
else:
return super(GeoWhereNode, self).make_atom(child, qn, connection)
View
2  django/contrib/gis/gdal/geometries.py
@@ -155,7 +155,7 @@ def from_bbox(cls, bbox):
"Constructs a Polygon from a bounding box (4-tuple)."
x0, y0, x1, y1 = bbox
return OGRGeometry('POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (
- x0, y0, x0, y1, x1, y1, x1, y0, x0, y0))
+ x0, y0, x0, y1, x1, y1, x1, y0, x0, y0))
### Geometry set-like operations ###
# g = g1 | g2
View
11 django/contrib/gis/geos/tests/test_geos_mutation.py
@@ -133,11 +133,12 @@ def test05_Polygon(self):
# _set_list
pg._set_list(2, (((1,2),(10,0),(12,9),(-1,15),(1,2)),
- ((4,2),(5,2),(5,3),(4,2))))
- self.assertEqual(pg.coords,
- (((1.0,2.0),(10.0,0.0),(12.0,9.0),(-1.0,15.0),(1.0,2.0)),
- ((4.0,2.0),(5.0,2.0),(5.0,3.0),(4.0,2.0))),
- 'Polygon _set_list')
+ ((4,2),(5,2),(5,3),(4,2))))
+ self.assertEqual(
+ pg.coords,
+ (((1.0,2.0),(10.0,0.0),(12.0,9.0),(-1.0,15.0),(1.0,2.0)),
+ ((4.0,2.0),(5.0,2.0),(5.0,3.0),(4.0,2.0))),
+ 'Polygon _set_list')
lsa = Polygon(*pg.coords)
for f in geos_function_tests:
View
10 django/contrib/messages/tests/base.py
@@ -354,11 +354,11 @@ def test_tags(self):
'success'])
@override_settings_tags(MESSAGE_TAGS={
- constants.INFO: 'info',
- constants.DEBUG: '',
- constants.WARNING: '',
- constants.ERROR: 'bad',
- 29: 'custom',
+ constants.INFO: 'info',
+ constants.DEBUG: '',
+ constants.WARNING: '',
+ constants.ERROR: 'bad',
+ 29: 'custom',
}
)
def test_custom_tags(self):
View
4 django/contrib/redirects/tests.py
@@ -13,7 +13,7 @@
@override_settings(
APPEND_SLASH=False,
MIDDLEWARE_CLASSES=list(settings.MIDDLEWARE_CLASSES) +
- ['django.contrib.redirects.middleware.RedirectFallbackMiddleware'],
+ ['django.contrib.redirects.middleware.RedirectFallbackMiddleware'],
SITE_ID=1,
)
class RedirectTests(TestCase):
@@ -72,7 +72,7 @@ class OverriddenRedirectFallbackMiddleware(RedirectFallbackMiddleware):
@override_settings(
MIDDLEWARE_CLASSES=list(settings.MIDDLEWARE_CLASSES) +
- ['django.contrib.redirects.tests.OverriddenRedirectFallbackMiddleware'],
+ ['django.contrib.redirects.tests.OverriddenRedirectFallbackMiddleware'],
SITE_ID=1,
)
class OverriddenRedirectMiddlewareTests(TestCase):
View
2  django/contrib/sitemaps/views.py
@@ -31,7 +31,7 @@ def index(request, sitemaps,
site = site()
protocol = req_protocol if site.protocol is None else site.protocol
sitemap_url = urlresolvers.reverse(
- sitemap_url_name, kwargs={'section': section})
+ sitemap_url_name, kwargs={'section': section})
absolute_url = '%s://%s%s' % (protocol, req_site.domain, sitemap_url)
sites.append(absolute_url)
for page in range(2, site.paginator.num_pages + 1):
View
8 django/core/handlers/base.py
@@ -165,9 +165,9 @@ def get_response(self, request):
response = callback(request, **param_dict)
except:
signals.got_request_exception.send(
- sender=self.__class__, request=request)
+ sender=self.__class__, request=request)
response = self.handle_uncaught_exception(request,
- resolver, sys.exc_info())
+ resolver, sys.exc_info())
except SuspiciousOperation as e:
# The request logger receives events for any problematic request
@@ -181,9 +181,9 @@ def get_response(self, request):
response = callback(request, **param_dict)
except:
signals.got_request_exception.send(
- sender=self.__class__, request=request)
+ sender=self.__class__, request=request)
response = self.handle_uncaught_exception(request,
- resolver, sys.exc_info())
+ resolver, sys.exc_info())
except SystemExit:
# Allow sys.exit() to actually exit. See tickets #1023 and #4701
View
2  django/core/management/commands/createcachetable.py
@@ -78,7 +78,7 @@ def create_table(self, database, tablename):
except DatabaseError as e:
raise CommandError(
"Cache table '%s' could not be created.\nThe error was: %s." %
- (tablename, force_text(e)))
+ (tablename, force_text(e)))
for statement in index_output:
curs.execute(statement)
if self.verbosity > 1:
View
20 django/core/management/commands/loaddata.py
@@ -46,8 +46,8 @@ def handle(self, *fixture_labels, **options):
if not len(fixture_labels):
raise CommandError(
- "No database fixture specified. Please provide the path "
- "of at least one fixture in the command line.")
+ "No database fixture specified. Please provide the path "
+ "of at least one fixture in the command line.")
self.verbosity = int(options.get('verbosity'))
@@ -140,10 +140,10 @@ def load_label(self, fixture_label):
obj.save(using=self.using)
except (DatabaseError, IntegrityError) as e:
e.args = ("Could not load %(app_label)s.%(object_name)s(pk=%(pk)s): %(error_msg)s" % {
- 'app_label': obj.object._meta.app_label,
- 'object_name': obj.object._meta.object_name,
- 'pk': obj.object.pk,
- 'error_msg': force_text(e)
+ 'app_label': obj.object._meta.app_label,
+ 'object_name': obj.object._meta.object_name,
+ 'pk': obj.object.pk,
+ 'error_msg': force_text(e)
},)
raise
@@ -176,8 +176,8 @@ def _find_fixtures(self, fixture_label):
# Check kept for backwards-compatibility; it doesn't look very useful.
if '.' in os.path.basename(fixture_name):
raise CommandError(
- "Problem installing fixture '%s': %s is not a known "
- "serialization format." % tuple(fixture_name.rsplit('.')))
+ "Problem installing fixture '%s': %s is not a known "
+ "serialization format." % tuple(fixture_name.rsplit('.')))
if self.verbosity >= 2:
self.stdout.write("Loading '%s' fixtures..." % fixture_name)
@@ -210,8 +210,8 @@ def _find_fixtures(self, fixture_label):
# duplicates are only allowed in different directories.
if len(fixture_files_in_dir) > 1:
raise CommandError(
- "Multiple fixtures named '%s' in %s. Aborting." %
- (fixture_name, humanize(fixture_dir)))
+ "Multiple fixtures named '%s' in %s. Aborting." %
+ (fixture_name, humanize(fixture_dir)))
fixture_files.extend(fixture_files_in_dir)
if fixture_name != 'initial_data' and not fixture_files:
View
2  django/core/management/commands/makemessages.py
@@ -225,7 +225,7 @@ def handle_noargs(self, *args, **options):
if (locale is None and not process_all) or self.domain is None:
raise CommandError("Type '%s help %s' for usage information." % (
- os.path.basename(sys.argv[0]), sys.argv[1]))
+ os.path.basename(sys.argv[0]), sys.argv[1]))
if self.verbosity > 1:
self.stdout.write('examining files with the extensions: %s\n'
View
8 django/core/serializers/xml_serializer.py
@@ -177,7 +177,7 @@ def _handle_object(self, node):
data = {}
if node.hasAttribute('pk'):
data[Model._meta.pk.attname] = Model._meta.pk.to_python(
- node.getAttribute('pk'))
+ node.getAttribute('pk'))
# Also start building a dict of m2m data (this is saved as
# {m2m_accessor_attribute : [list_of_related_objects]})
@@ -272,15 +272,15 @@ def _get_model_from_node(self, node, attr):
if not model_identifier:
raise base.DeserializationError(
"<%s> node is missing the required '%s' attribute"
- % (node.nodeName, attr))
+ % (node.nodeName, attr))
try:
Model = models.get_model(*model_identifier.split("."))
except TypeError:
Model = None
if Model is None:
raise base.DeserializationError(
- "<%s> node has invalid model identifier: '%s'" %
- (node.nodeName, model_identifier))
+ "<%s> node has invalid model identifier: '%s'"
+ % (node.nodeName, model_identifier))
return Model
View
30 django/db/models/base.py
@@ -107,16 +107,20 @@ def __new__(cls, name, bases, attrs):
new_class.add_to_class('_meta', Options(meta, **kwargs))
if not abstract:
- new_class.add_to_class('DoesNotExist', subclass_exception(str('DoesNotExist'),
- tuple(x.DoesNotExist
- for x in parents if hasattr(x, '_meta') and not x._meta.abstract)
- or (ObjectDoesNotExist,),
- module, attached_to=new_class))
- new_class.add_to_class('MultipleObjectsReturned', subclass_exception(str('MultipleObjectsReturned'),
- tuple(x.MultipleObjectsReturned
- for x in parents if hasattr(x, '_meta') and not x._meta.abstract)
- or (MultipleObjectsReturned,),
- module, attached_to=new_class))
+ new_class.add_to_class(
+ 'DoesNotExist',
+ subclass_exception(
+ str('DoesNotExist'),
+ tuple(x.DoesNotExist for x in parents if hasattr(x, '_meta') and not x._meta.abstract) or (ObjectDoesNotExist,),
+ module,
+ attached_to=new_class))
+ new_class.add_to_class(
+ 'MultipleObjectsReturned',
+ subclass_exception(
+ str('MultipleObjectsReturned'),
+ tuple(x.MultipleObjectsReturned for x in parents if hasattr(x, '_meta') and not x._meta.abstract) or (MultipleObjectsReturned,),
+ module,
+ attached_to=new_class))
if base_meta and not base_meta.abstract:
# Non-abstract child classes inherit some attributes from their
# non-abstract parent (unless an ABC comes before it in the
@@ -565,9 +569,9 @@ def save(self, force_insert=False, force_update=False, using=None,
field_names.add(field.attname)
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)]
+ if (f.attname not in self.__dict__ and
+ isinstance(self.__class__.__dict__[f.attname], DeferredAttribute))
+ ]
loaded_fields = field_names.difference(deferred_fields)
if loaded_fields:
View
2  django/db/models/query.py
@@ -694,7 +694,7 @@ def exclude(self, *args, **kwargs):
def _filter_or_exclude(self, negate, *args, **kwargs):
if args or kwargs:
assert self.query.can_filter(), \
- "Cannot filter a query once a slice has been taken."
+ "Cannot filter a query once a slice has been taken."
clone = self._clone()
if negate:
View
4 django/db/models/sql/query.py
@@ -1681,7 +1681,7 @@ def add_count_column(self):
count = self.aggregates_module.Count('*', is_summary=True)
else:
assert len(self.select) == 1, \
- "Cannot add count col with multiple cols in 'select': %r" % self.select
+ "Cannot add count col with multiple cols in 'select': %r" % self.select
count = self.aggregates_module.Count(self.select[0].col)
else:
opts = self.get_meta()
@@ -1693,7 +1693,7 @@ def add_count_column(self):
# Because of SQL portability issues, multi-column, distinct
# counts need a sub-query -- see get_count() for details.
assert len(self.select) == 1, \
- "Cannot add count col with multiple cols in 'select'."
+ "Cannot add count col with multiple cols in 'select'."
count = self.aggregates_module.Count(self.select[0].col, distinct=True)
# Distinct handling is done in Count(), so don't do it at this
View
2  django/db/models/sql/subqueries.py
@@ -262,7 +262,7 @@ class DateTimeQuery(DateQuery):
def _check_field(self, field):
assert isinstance(field, DateTimeField), \
- "%r isn't a DateTimeField." % field.name
+ "%r isn't a DateTimeField." % field.name
def _get_select(self, col, lookup_type):
if self.tzinfo is None:
View
4 django/db/transaction.py
@@ -17,8 +17,8 @@
from functools import wraps
from django.db import (
- connections, DEFAULT_DB_ALIAS,
- DatabaseError, ProgrammingError)
+ connections, DEFAULT_DB_ALIAS,
+ DatabaseError, ProgrammingError)
from django.utils.decorators import available_attrs
View
6 django/forms/models.py
@@ -687,7 +687,7 @@ def get_unique_error_message(self, unique_check):
else:
return ugettext("Please correct the duplicate data for %(field)s, "
"which must be unique.") % {
- "field": get_text_list(unique_check, six.text_type(_("and"))),
+ "field": get_text_list(unique_check, six.text_type(_("and"))),
}
def get_date_error_message(self, date_check):
@@ -1042,8 +1042,8 @@ def __iter__(self):
yield self.choice(obj)
def __len__(self):
- return len(self.queryset) +\
- (1 if self.field.empty_label is not None else 0)
+ return (len(self.queryset) +
+ (1 if self.field.empty_label is not None else 0))
def choice(self, obj):
return (self.field.prepare_value(obj), self.field.label_from_instance(obj))
View
6 django/forms/widgets.py
@@ -62,9 +62,9 @@ def render_css(self):
# We need to sort the keys, and iterate over the sorted list.
media = sorted(self._css.keys())
return chain(*[
- [format_html('<link href="{0}" type="text/css" media="{1}" rel="stylesheet" />', self.absolute_path(path), medium)
- for path in self._css[medium]]
- for medium in media])
+ [format_html('<link href="{0}" type="text/css" media="{1}" rel="stylesheet" />', self.absolute_path(path), medium)
+ for path in self._css[medium]]
+ for medium in media])
def absolute_path(self, path, prefix=None):
if path.startswith(('http://', 'https://', '/')):
View
4 django/http/utils.py
@@ -59,8 +59,8 @@ def fix_IE_for_attach(request, response):
pass
if response.has_header('Cache-Control'):
cache_control_values = [value.strip() for value in
- response['Cache-Control'].split(',')
- if value.strip().lower() not in offending_headers]
+ response['Cache-Control'].split(',')
+ if value.strip().lower() not in offending_headers]
if not len(cache_control_values):
del response['Cache-Control']
View
2  django/middleware/locale.py
@@ -38,7 +38,7 @@ def process_request(self, request):
def process_response(self, request, response):
language = translation.get_language()
language_from_path = translation.get_language_from_path(
- request.path_info, supported=self._supported_languages
+ request.path_info, supported=self._supported_languages
)
if (response.status_code == 404 and not language_from_path
and self.is_language_prefix_patterns_used()):
View
2  django/test/runner.py
@@ -279,7 +279,7 @@ def setup_databases(verbosity, interactive, **kwargs):
connection = connections[alias]
if test_db_name is None:
test_db_name = connection.creation.create_test_db(
- verbosity, autoclobber=not interactive)
+ verbosity, autoclobber=not interactive)
destroy = True
else:
connection.settings_dict['NAME'] = test_db_name
View
2  django/test/testcases.py
@@ -740,7 +740,7 @@ def _reset_sequences(self, db_name):
conn = connections[db_name]
if conn.features.supports_sequence_reset:
sql_list = conn.ops.sequence_reset_by_name_sql(
- no_style(), conn.introspection.sequence_list())
+ no_style(), conn.introspection.sequence_list())
if sql_list:
with transaction.commit_on_success_unless_managed(using=db_name):
cursor = conn.cursor()
View
4 django/utils/html.py
@@ -97,8 +97,8 @@ def format_html_join(sep, format_string, args_generator):
"""
return mark_safe(conditional_escape(sep).join(
- format_html(format_string, *tuple(args))
- for args in args_generator))
+ format_html(format_string, *tuple(args))
+ for args in args_generator))
def linebreaks(value, autoescape=False):
View
4 django/utils/http.py
@@ -14,8 +14,8 @@
from django.utils.functional import allow_lazy
from django.utils import six
from django.utils.six.moves.urllib.parse import (
- quote, quote_plus, unquote, unquote_plus, urlparse,
- urlencode as original_urlencode)
+ quote, quote_plus, unquote, unquote_plus, urlparse,
+ urlencode as original_urlencode)
ETAG_MATCH = re.compile(r'(?:W/)?"((?:\\.|[^"])*)"')
View
18 django/utils/jslex.py
@@ -143,14 +143,14 @@ class JsLexer(Lexer):
]
states = {
- 'div': # slash will mean division
- both_before + [
- Tok("punct", literals("/= /"), next='reg'),
- ] + both_after,
-
- 'reg': # slash will mean regex
- both_before + [
- Tok("regex",
+ # slash will mean division
+ 'div': both_before + [
+ Tok("punct", literals("/= /"), next='reg'),
+ ] + both_after,
+
+ # slash will mean regex
+ 'reg': both_before + [
+ Tok("regex",
r"""
/ # opening slash
# First character is..
@@ -174,7 +174,7 @@ class JsLexer(Lexer):
/ # closing slash
[a-zA-Z0-9]* # trailing flags
""", next='div'),
- ] + both_after,
+ ] + both_after,
}
def __init__(self):
View
2  django/utils/timezone.py
@@ -136,7 +136,7 @@ def _isdst(self, dt):
except (OverflowError, ValueError) as exc:
exc_type = type(exc)
exc_value = exc_type(
- "Unsupported value: %r. You should install pytz." % dt)
+ "Unsupported value: %r. You should install pytz." % dt)
exc_value.__cause__ = exc
six.reraise(exc_type, exc_value, sys.exc_info()[2])
View
2  django/views/generic/dates.py
@@ -366,7 +366,7 @@ def get_dated_queryset(self, ordering=None, **lookup):
is_empty = len(qs) == 0 if paginate_by is None else not qs.exists()
if is_empty:
raise Http404(_("No %(verbose_name_plural)s available") % {
- 'verbose_name_plural': force_text(qs.model._meta.verbose_name_plural)
+ 'verbose_name_plural': force_text(qs.model._meta.verbose_name_plural)
})
return qs
View
4 django/views/generic/list.py
@@ -65,8 +65,8 @@ def paginate_queryset(self, queryset, page_size):
return (paginator, page, page.object_list, page.has_other_pages())
except InvalidPage as e:
raise Http404(_('Invalid page (%(page_number)s): %(message)s') % {
- 'page_number': page_number,
- 'message': str(e)
+ 'page_number': page_number,
+ 'message': str(e)
})
def get_paginate_by(self, queryset):
View
4 docs/_ext/applyxrefs.py
@@ -6,8 +6,8 @@
testing = False
DONT_TOUCH = (
- './index.txt',
- )
+ './index.txt',
+)
def target_name(fn):
if fn.endswith('.txt'):
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=E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,F401,F403,W601
+ignore=E124,E125,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,F401,F403,W601
[metadata]
license-file = LICENSE
View
11 tests/admin_views/models.py
@@ -169,10 +169,9 @@ def __str__(self):
class Fabric(models.Model):
NG_CHOICES = (
('Textured', (
- ('x', 'Horizontal'),
- ('y', 'Vertical'),
- )
- ),
+ ('x', 'Horizontal'),
+ ('y', 'Vertical'),
+ )),
('plain', 'Smooth'),
)
surface = models.CharField(max_length=20, choices=NG_CHOICES)
@@ -390,8 +389,8 @@ class Post(models.Model):
title = models.CharField(max_length=100, help_text="Some help text for the title (with unicode ŠĐĆŽćžšđ)")
content = models.TextField(help_text="Some help text for the content (with unicode ŠĐĆŽćžšđ)")
posted = models.DateField(
- default=datetime.date.today,
- help_text="Some help text for the date (with unicode ŠĐĆŽćžšđ)"
+ default=datetime.date.today,
+ help_text="Some help text for the date (with unicode ŠĐĆŽćžšđ)"
)
public = models.NullBooleanField()
View
12 tests/admin_views/tests.py
@@ -425,12 +425,10 @@ def testRelationSpanningFilters(self):
test=lambda obj, value: obj.chap.book.name == value),
'chap__book__promo__id__exact': dict(
values=[p.id for p in Promo.objects.all()],
- test=lambda obj, value:
- obj.chap.book.promo_set.filter(id=value).exists()),
+ test=lambda obj, value: obj.chap.book.promo_set.filter(id=value).exists()),
'chap__book__promo__name': dict(
values=[p.name for p in Promo.objects.all()],
- test=lambda obj, value:
- obj.chap.book.promo_set.filter(name=value).exists()),
+ test=lambda obj, value: obj.chap.book.promo_set.filter(name=value).exists()),
}
for filter_path, params in filters.items():
for value in params['values']:
@@ -1253,9 +1251,9 @@ def testCustomModelAdminTemplates(self):
response = self.client.get('/test_admin/admin/admin_views/customarticle/%d/delete/' % article_pk)
self.assertTemplateUsed(response, 'custom_admin/delete_confirmation.html')
response = self.client.post('/test_admin/admin/admin_views/customarticle/', data={
- 'index': 0,
- 'action': ['delete_selected'],
- '_selected_action': ['1'],
+ 'index': 0,
+ 'action': ['delete_selected'],
+ '_selected_action': ['1'],
})
self.assertTemplateUsed(response, 'custom_admin/delete_selected_confirmation.html')
response = self.client.get('/test_admin/admin/admin_views/customarticle/%d/history/' % article_pk)
View
8 tests/admin_widgets/tests.py
@@ -54,8 +54,12 @@ class MyModelAdmin(admin.ModelAdmin):
# Check that we got a field of the right type
self.assertTrue(
isinstance(widget, widgetclass),
- "Wrong widget for %s.%s: expected %s, got %s" %
- (model.__class__.__name__, fieldname, widgetclass, type(widget))
+ "Wrong widget for %s.%s: expected %s, got %s" % (
+ model.__class__.__name__,
+ fieldname,
+ widgetclass,
+ type(widget),
+ )
)
# Return the formfield so that other tests can continue
View
6 tests/basic/tests.py
@@ -605,8 +605,7 @@ def test_extra_method_select_argument_with_dashes_and_values(self):
)
dicts = Article.objects.filter(
- pub_date__year=2008).extra(
- select={'dashed-value': '1'}
+ pub_date__year=2008).extra(select={'dashed-value': '1'}
).values('headline', 'dashed-value')
self.assertEqual([sorted(d.items()) for d in dicts],
[[('dashed-value', 1), ('headline', 'Article 11')], [('dashed-value', 1), ('headline', 'Article 12')]])
@@ -629,8 +628,7 @@ def test_extra_method_select_argument_with_dashes(self):
)
articles = Article.objects.filter(
- pub_date__year=2008).extra(
- select={'dashed-value': '1', 'undashedvalue': '2'})
+ pub_date__year=2008).extra(select={'dashed-value': '1', 'undashedvalue': '2'})
self.assertEqual(articles[0].undashedvalue, 2)
def test_create_relation_with_ugettext_lazy(self):
View
118 tests/cache/tests.py
@@ -1138,14 +1138,14 @@ def test_close(self):
@override_settings(
- CACHE_MIDDLEWARE_KEY_PREFIX='settingsprefix',
- CACHE_MIDDLEWARE_SECONDS=1,
- CACHES={
- 'default': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- },
+ CACHE_MIDDLEWARE_KEY_PREFIX='settingsprefix',
+ CACHE_MIDDLEWARE_SECONDS=1,
+ CACHES={
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
- USE_I18N=False,
+ },
+ USE_I18N=False,
)
class CacheUtils(TestCase):
"""TestCase for django.utils.cache functions."""
@@ -1245,25 +1245,25 @@ def test_patch_cache_control(self):
@override_settings(
- CACHES={
- 'default': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- 'KEY_PREFIX': 'cacheprefix',
- },
+ CACHES={
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
+ 'KEY_PREFIX': 'cacheprefix',
},
+ },
)
class PrefixedCacheUtils(CacheUtils):
pass
@override_settings(
- CACHE_MIDDLEWARE_SECONDS=60,
- CACHE_MIDDLEWARE_KEY_PREFIX='test',
- CACHES={
- 'default': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- },
+ CACHE_MIDDLEWARE_SECONDS=60,
+ CACHE_MIDDLEWARE_KEY_PREFIX='test',
+ CACHES={
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
+ },
)
class CacheHEADTest(TestCase):
@@ -1318,16 +1318,16 @@ def test_head_with_cached_get(self):
@override_settings(
- CACHE_MIDDLEWARE_KEY_PREFIX='settingsprefix',
- CACHES={
- 'default': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- },
+ CACHE_MIDDLEWARE_KEY_PREFIX='settingsprefix',
+ CACHES={
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
- LANGUAGES=(
- ('en', 'English'),
- ('es', 'Spanish'),
- ),
+ },
+ LANGUAGES=(
+ ('en', 'English'),
+ ('es', 'Spanish'),
+ ),
)
class CacheI18nTest(TestCase):
@@ -1496,10 +1496,10 @@ def tzname(self, dt):
"Cache keys should include the time zone name when time zones are active")
@override_settings(
- CACHE_MIDDLEWARE_KEY_PREFIX="test",
- CACHE_MIDDLEWARE_SECONDS=60,
- USE_ETAGS=True,
- USE_I18N=True,
+ CACHE_MIDDLEWARE_KEY_PREFIX="test",
+ CACHE_MIDDLEWARE_SECONDS=60,
+ USE_ETAGS=True,
+ USE_I18N=True,
)
def test_middleware(self):
def set_cache(request, lang, msg):
@@ -1560,9 +1560,9 @@ def set_cache(request, lang, msg):
translation.deactivate()
@override_settings(
- CACHE_MIDDLEWARE_KEY_PREFIX="test",
- CACHE_MIDDLEWARE_SECONDS=60,
- USE_ETAGS=True,
+ CACHE_MIDDLEWARE_KEY_PREFIX="test",
+ CACHE_MIDDLEWARE_SECONDS=60,
+ USE_ETAGS=True,
)
def test_middleware_doesnt_cache_streaming_response(self):
request = self._get_request()
@@ -1581,12 +1581,12 @@ def test_middleware_doesnt_cache_streaming_response(self):
self.assertIsNone(get_cache_data)
@override_settings(
- CACHES={
- 'default': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- 'KEY_PREFIX': 'cacheprefix'
- },
+ CACHES={
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
+ 'KEY_PREFIX': 'cacheprefix'
},
+ },
)
class PrefixedCacheI18nTest(CacheI18nTest):
pass
@@ -1597,20 +1597,20 @@ def hello_world_view(request, value):
@override_settings(
- CACHE_MIDDLEWARE_ALIAS='other',
- CACHE_MIDDLEWARE_KEY_PREFIX='middlewareprefix',
- CACHE_MIDDLEWARE_SECONDS=30,
- CACHE_MIDDLEWARE_ANONYMOUS_ONLY=False,
- CACHES={
- 'default': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- },
- 'other': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- 'LOCATION': 'other',
- 'TIMEOUT': '1',
- },
+ CACHE_MIDDLEWARE_ALIAS='other',
+ CACHE_MIDDLEWARE_KEY_PREFIX='middlewareprefix',
+ CACHE_MIDDLEWARE_SECONDS=30,
+ CACHE_MIDDLEWARE_ANONYMOUS_ONLY=False,
+ CACHES={
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
+ },
+ 'other': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
+ 'LOCATION': 'other',
+ 'TIMEOUT': '1',
},
+ },
)
class CacheMiddlewareTest(IgnoreDeprecationWarningsMixin, TestCase):
@@ -1816,14 +1816,14 @@ def test_view_decorator(self):
self.assertEqual(response.content, b'Hello World 16')
@override_settings(
- CACHE_MIDDLEWARE_KEY_PREFIX='settingsprefix',
- CACHE_MIDDLEWARE_SECONDS=1,
- CACHES={
- 'default': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- },
+ CACHE_MIDDLEWARE_KEY_PREFIX='settingsprefix',
+ CACHE_MIDDLEWARE_SECONDS=1,
+ CACHES={
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
- USE_I18N=False,
+ },
+ USE_I18N=False,
)
class TestWithTemplateResponse(TestCase):
"""
View
3  tests/distinct_on_fields/tests.py
@@ -51,8 +51,7 @@ def test_basic_distinct_on(self):
['<Staff: p1>', '<Staff: p1>', '<Staff: p2>', '<Staff: p3>'],
),
(
- Celebrity.objects.filter(fan__in=[self.fan1, self.fan2, self.fan3]).
- distinct('name').order_by('name'),
+ Celebrity.objects.filter(fan__in=[self.fan1, self.fan2, self.fan3]).distinct('name').order_by('name'),
['<Celebrity: c1>', '<Celebrity: c2>'],
),
# Does combining querysets work?
View
31 tests/extra_regress/tests.py
@@ -13,9 +13,9 @@ class ExtraRegressTests(TestCase):
def setUp(self):
self.u = User.objects.create_user(
- username="fred",
- password="secret",
- email="fred@example.com"
+ username="fred",
+ password="secret",
+ email="fred@example.com"
)
def test_regression_7314_7372(self):
@@ -41,9 +41,9 @@ def test_regression_7314_7372(self):
# Queryset to match most recent revision:
qs = RevisionableModel.objects.extra(
- where=["%(table)s.id IN (SELECT MAX(rev.id) FROM %(table)s rev GROUP BY rev.base_id)" % {
- 'table': RevisionableModel._meta.db_table,
- }]
+ where=["%(table)s.id IN (SELECT MAX(rev.id) FROM %(table)s rev GROUP BY rev.base_id)" % {
+ 'table': RevisionableModel._meta.db_table,
+ }]
)
self.assertQuerysetEqual(qs,
@@ -74,8 +74,8 @@ def test_extra_stay_tied(self):
# select portions. Applies when portions are updated or otherwise
# moved around.
qs = User.objects.extra(
- select=OrderedDict((("alpha", "%s"), ("beta", "2"), ("gamma", "%s"))),
- select_params=(1, 3)
+ select=OrderedDict((("alpha", "%s"), ("beta", "2"), ("gamma", "%s"))),
+ select_params=(1, 3)
)
qs = qs.extra(select={"beta": 4})
qs = qs.extra(select={"alpha": "%s"}, select_params=[5])
@@ -129,11 +129,11 @@ def test_regression_8039(self):
should still be present because of the extra() call.
"""
self.assertQuerysetEqual(
- Order.objects.extra(where=["username=%s"],
- params=["fred"],
- tables=["auth_user"]
- ).order_by('created_by'),
- []
+ Order.objects.extra(where=["username=%s"],
+ params=["fred"],
+ tables=["auth_user"]
+ ).order_by('created_by'),
+ []
)
def test_regression_8819(self):
@@ -294,7 +294,7 @@ def test_regression_10847(self):
self.assertQuerysetEqual(
TestObject.objects.filter(
- pk__in=TestObject.objects.extra(select={'extra': 1}).values('pk')
+ pk__in=TestObject.objects.extra(select={'extra': 1}).values('pk')
),
['<TestObject: TestObject: first,second,third>']
)
@@ -312,8 +312,7 @@ def test_regression_10847(self):
)
self.assertQuerysetEqual(
- TestObject.objects.filter(pk=obj.pk) |
- TestObject.objects.extra(where=["id > %s"], params=[obj.pk]),
+ TestObject.objects.filter(pk=obj.pk) | TestObject.objects.extra(where=["id > %s"], params=[obj.pk]),
['<TestObject: TestObject: first,second,third>']
)
View
3  tests/file_uploads/tests.py
@@ -377,8 +377,7 @@ def test_filename_case_preservation(self):
vars = {'boundary': 'oUrBoUnDaRyStRiNg'}
post_data = [
'--%(boundary)s',
- 'Content-Disposition: form-data; name="file_field"; '
- 'filename="MiXeD_cAsE.txt"',
+ 'Content-Disposition: form-data; name="file_field"; filename="MiXeD_cAsE.txt"',
'Content-Type: application/octet-stream',
'',
'file contents\n'
View
52 tests/forms_tests/tests/test_fields.py
@@ -1134,14 +1134,14 @@ def test_filepathfield_2(self):
f.choices = [p for p in f.choices if p[0].endswith('.py')]
f.choices.sort()
expected = [
- ('/django/forms/__init__.py', '__init__.py'),
- ('/django/forms/fields.py', 'fields.py'),
- ('/django/forms/forms.py', 'forms.py'),
- ('/django/forms/formsets.py', 'formsets.py'),
- ('/django/forms/models.py', 'models.py'),
- ('/django/forms/util.py', 'util.py'),
- ('/django/forms/utils.py', 'utils.py'),
- ('/django/forms/widgets.py', 'widgets.py')
+ ('/django/forms/__init__.py', '__init__.py'),
+ ('/django/forms/fields.py', 'fields.py'),
+ ('/django/forms/forms.py', 'forms.py'),
+ ('/django/forms/formsets.py', 'formsets.py'),
+ ('/django/forms/models.py', 'models.py'),
+ ('/django/forms/util.py', 'util.py'),
+ ('/django/forms/utils.py', 'utils.py'),
+ ('/django/forms/widgets.py', 'widgets.py')
]
for exp, got in zip(expected, fix_os_paths(f.choices)):
self.assertEqual(exp[1], got[1])
@@ -1155,14 +1155,14 @@ def test_filepathfield_3(self):
f = FilePathField(path=path, match='^.*?\.py$')
f.choices.sort()
expected = [
- ('/django/forms/__init__.py', '__init__.py'),
- ('/django/forms/fields.py', 'fields.py'),
- ('/django/forms/forms.py', 'forms.py'),
- ('/django/forms/formsets.py', 'formsets.py'),
- ('/django/forms/models.py', 'models.py'),
- ('/django/forms/util.py', 'util.py'),
- ('/django/forms/utils.py', 'utils.py'),
- ('/django/forms/widgets.py', 'widgets.py')
+ ('/django/forms/__init__.py', '__init__.py'),
+ ('/django/forms/fields.py', 'fields.py'),
+ ('/django/forms/forms.py', 'forms.py'),
+ ('/django/forms/formsets.py', 'formsets.py'),
+ ('/django/forms/models.py', 'models.py'),
+ ('/django/forms/util.py', 'util.py'),
+ ('/django/forms/utils.py', 'utils.py'),
+ ('/django/forms/widgets.py', 'widgets.py')
]
for exp, got in zip(expected, fix_os_paths(f.choices)):
self.assertEqual(exp[1], got[1])
@@ -1174,16 +1174,16 @@ def test_filepathfield_4(self):
f = FilePathField(path=path, recursive=True, match='^.*?\.py$')
f.choices.sort()
expected = [
- ('/django/forms/__init__.py', '__init__.py'),
- ('/django/forms/extras/__init__.py', 'extras/__init__.py'),
- ('/django/forms/extras/widgets.py', 'extras/widgets.py'),
- ('/django/forms/fields.py', 'fields.py'),
- ('/django/forms/forms.py', 'forms.py'),
- ('/django/forms/formsets.py', 'formsets.py'),
- ('/django/forms/models.py', 'models.py'),
- ('/django/forms/util.py', 'util.py'),
- ('/django/forms/utils.py', 'utils.py'),
- ('/django/forms/widgets.py', 'widgets.py')
+ ('/django/forms/__init__.py', '__init__.py'),
+ ('/django/forms/extras/__init__.py', 'extras/__init__.py'),
+ ('/django/forms/extras/widgets.py', 'extras/widgets.py'),
+ ('/django/forms/fields.py', 'fields.py'),
+ ('/django/forms/forms.py', 'forms.py'),
+ ('/django/forms/formsets.py', 'formsets.py'),
+ ('/django/forms/models.py', 'models.py'),
+ ('/django/forms/util.py', 'util.py'),
+ ('/django/forms/utils.py', 'utils.py'),
+ ('/django/forms/widgets.py', 'widgets.py')
]
for exp, got in zip(expected, fix_os_paths(f.choices)):
self.assertEqual(exp[1], got[1])
View
12 tests/forms_tests/tests/test_widgets.py
@@ -1182,9 +1182,9 @@ def test_clear_input_checked_returns_false(self):
widget = ClearableFileInput()
widget.is_required = False
self.assertEqual(widget.value_from_datadict(
- data={'myfile-clear': True},
- files={},
- name='myfile'), False)
+ data={'myfile-clear': True},
+ files={},
+ name='myfile'), False)
def test_clear_input_checked_returns_false_only_if_not_required(self):
"""
@@ -1196,6 +1196,6 @@ def test_clear_input_checked_returns_false_only_if_not_required(self):
widget.is_required = True
f = SimpleUploadedFile('something.txt', b'content')
self.assertEqual(widget.value_from_datadict(
- data={'myfile-clear': True},
- files={'myfile': f},
- name='myfile'), f)
+ data={'myfile-clear': True},
+ files={'myfile': f},
+ name='myfile'), f)
View
8 tests/forms_tests/tests/tests.py
@@ -124,10 +124,10 @@ def test_initial_instance_value(self):
obj2 = ChoiceOptionModel.objects.create(id=2, name='option 2')
obj3 = ChoiceOptionModel.objects.create(id=3, name='option 3')
self.assertHTMLEqual(ChoiceFieldForm(initial={
- 'choice': obj2,
- 'choice_int': obj2,
- 'multi_choice': [obj2,obj3],
- 'multi_choice_int': ChoiceOptionModel.objects.exclude(name="default"),
+ 'choice': obj2,
+ 'choice_int': obj2,
+ 'multi_choice': [obj2,obj3],
+ 'multi_choice_int': ChoiceOptionModel.objects.exclude(name="default"),
}).as_p(), """<p><label for="id_choice">Choice:</label> <select name="choice" id="id_choice">
<option value="1">ChoiceOption 1</option>
<option value="2" selected="selected">ChoiceOption 2</option>
View
42 tests/generic_relations/tests.py
@@ -98,23 +98,23 @@ def test_generic_relations(self):
)
self.assertQuerysetEqual(TaggedItem.objects.all(), [
- ('clearish', Mineral, quartz.pk),
- ('fatty', Animal, platypus.pk),
- ('fatty', Vegetable, bacon.pk),
- ('hairy', Animal, lion.pk),
- ('salty', Vegetable, bacon.pk),
- ('shiny', Animal, platypus.pk),
- ('yellow', Animal, lion.pk)
+ ('clearish', Mineral, quartz.pk),
+ ('fatty', Animal, platypus.pk),
+ ('fatty', Vegetable, bacon.pk),
+ ('hairy', Animal, lion.pk),
+ ('salty', Vegetable, bacon.pk),
+ ('shiny', Animal, platypus.pk),
+ ('yellow', Animal, lion.pk)
],
comp_func
)
lion.delete()
self.assertQuerysetEqual(TaggedItem.objects.all(), [
- ('clearish', Mineral, quartz.pk),
- ('fatty', Animal, platypus.pk),
- ('fatty', Vegetable, bacon.pk),
- ('salty', Vegetable, bacon.pk),
- ('shiny', Animal, platypus.pk)
+ ('clearish', Mineral, quartz.pk),
+ ('fatty', Animal, platypus.pk),
+ ('fatty', Vegetable, bacon.pk),
+ ('salty', Vegetable, bacon.pk),
+ ('shiny', Animal, platypus.pk)
],
comp_func
)
@@ -124,11 +124,11 @@ def test_generic_relations(self):
quartz_pk = quartz.pk
quartz.delete()
self.assertQuerysetEqual(TaggedItem.objects.all(), [
- ('clearish', Mineral, quartz_pk),
- ('fatty', Animal, platypus.pk),
- ('fatty', Vegetable, bacon.pk),
- ('salty', Vegetable, bacon.pk),
- ('shiny', Animal, platypus.pk)
+ ('clearish', Mineral, quartz_pk),
+ ('fatty', Animal, platypus.pk),
+ ('fatty', Vegetable, bacon.pk),
+ ('salty', Vegetable, bacon.pk),
+ ('shiny', Animal, platypus.pk)
],
comp_func
)
@@ -138,10 +138,10 @@ def test_generic_relations(self):
tag.delete()
self.assertQuerysetEqual(bacon.tags.all(), ["<TaggedItem: salty>"])
self.assertQuerysetEqual(TaggedItem.objects.all(), [
- ('clearish', Mineral, quartz_pk),
- ('fatty', Animal, platypus.pk),
- ('salty', Vegetable, bacon.pk),
- ('shiny', Animal, platypus.pk)
+ ('clearish', Mineral, quartz_pk),
+ ('fatty', Animal, platypus.pk),
+ ('salty', Vegetable, bacon.pk),
+ ('shiny', Animal, platypus.pk)
],
comp_func
)
View
4 tests/i18n/tests.py
@@ -600,8 +600,8 @@ def test_l10n_enabled(self):
# Russian locale (with E as month)
with translation.override('ru', deactivate=True):
self.assertHTMLEqual(
- '<select name="mydate_day" id="id_mydate_day">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31" selected="selected">31</option>\n</select>\n<select name="mydate_month" id="id_mydate_month">\n<option value="1">\u042f\u043d\u0432\u0430\u0440\u044c</option>\n<option value="2">\u0424\u0435\u0432\u0440\u0430\u043b\u044c</option>\n<option value="3">\u041c\u0430\u0440\u0442</option>\n<option value="4">\u0410\u043f\u0440\u0435\u043b\u044c</option>\n<option value="5">\u041c\u0430\u0439</option>\n<option value="6">\u0418\u044e\u043d\u044c</option>\n<option value="7">\u0418\u044e\u043b\u044c</option>\n<option value="8">\u0410\u0432\u0433\u0443\u0441\u0442</option>\n<option value="9">\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c</option>\n<option value="10">\u041e\u043a\u0442\u044f\u0431\u0440\u044c</option>\n<option value="11">\u041d\u043e\u044f\u0431\u0440\u044c</option>\n<option value="12" selected="selected">\u0414\u0435\u043a\u0430\u0431\u0440\u044c</option>\n</select>\n<select name="mydate_year" id="id_mydate_year">\n<option value="2009" selected="selected">2009</option>\n<option value="2010">2010</option>\n<option value="2011">2011</option>\n<option value="2012">2012</option>\n<option value="2013">2013</option>\n<option value="2014">2014</option>\n<option value="2015">2015</option>\n<option value="2016">2016</option>\n<option value="2017">2017</option>\n<option value="2018">2018</option>\n</select>',
- SelectDateWidget(years=range(2009, 2019)).render('mydate', datetime.date(2009, 12, 31))
+ '<select name="mydate_day" id="id_mydate_day">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31" selected="selected">31</option>\n</select>\n<select name="mydate_month" id="id_mydate_month">\n<option value="1">\u042f\u043d\u0432\u0430\u0440\u044c</option>\n<option value="2">\u0424\u0435\u0432\u0440\u0430\u043b\u044c</option>\n<option value="3">\u041c\u0430\u0440\u0442</option>\n<option value="4">\u0410\u043f\u0440\u0435\u043b\u044c</option>\n<option value="5">\u041c\u0430\u0439</option>\n<option value="6">\u0418\u044e\u043d\u044c</option>\n<option value="7">\u0418\u044e\u043b\u044c</option>\n<option value="8">\u0410\u0432\u0433\u0443\u0441\u0442</option>\n<option value="9">\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c</option>\n<option value="10">\u041e\u043a\u0442\u044f\u0431\u0440\u044c</option>\n<option value="11">\u041d\u043e\u044f\u0431\u0440\u044c</option>\n<option value="12" selected="selected">\u0414\u0435\u043a\u0430\u0431\u0440\u044c</option>\n</select>\n<select name="mydate_year" id="id_mydate_year">\n<option value="2009" selected="selected">2009</option>\n<option value="2010">2010</option>\n<option value="2011">2011</option>\n<option value="2012">2012</option>\n<option value="2013">2013</option>\n<option value="2014">2014</option>\n<option value="2015">2015</option>\n<option value="2016">2016</option>\n<option value="2017">2017</option>\n<option value="2018">2018</option>\n</select>',
+ SelectDateWidget(years=range(2009, 2019)).render('mydate', datetime.date(2009, 12, 31))
)
# English locale
View
26 tests/logging_tests/tests.py
@@ -169,8 +169,8 @@ def test_fail_silently(self):
self.assertTrue(admin_email_handler.connection().fail_silently)
@override_settings(
- ADMINS=(('whatever admin', 'admin@example.com'),),
- EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-'
+ ADMINS=(('whatever admin', 'admin@example.com'),),
+ EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-'
)
def test_accepts_args(self):
"""
@@ -199,9 +199,9 @@ def test_accepts_args(self):
admin_email_handler.filters = orig_filters
@override_settings(
- ADMINS=(('whatever admin', 'admin@example.com'),),
- EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-',
- INTERNAL_IPS=('127.0.0.1',),
+ ADMINS=(('whatever admin', 'admin@example.com'),),
+ EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-',
+ INTERNAL_IPS=('127.0.0.1',),
)
def test_accepts_args_and_request(self):
"""
@@ -234,9 +234,9 @@ def test_accepts_args_and_request(self):
admin_email_handler.filters = orig_filters
@override_settings(
- ADMINS=(('admin', 'admin@example.com'),),
- EMAIL_SUBJECT_PREFIX='',
- DEBUG=False,
+ ADMINS=(('admin', 'admin@example.com'),),
+ EMAIL_SUBJECT_PREFIX='',
+ DEBUG=False,
)
def test_subject_accepts_newlines(self):
"""
@@ -257,9 +257,9 @@ def test_subject_accepts_newlines(self):
self.assertEqual(mail.outbox[0].subject, expected_subject)
@override_settings(
- ADMINS=(('admin', 'admin@example.com'),),
- EMAIL_SUBJECT_PREFIX='',
- DEBUG=False,
+ ADMINS=(('admin', 'admin@example.com'),),
+ EMAIL_SUBJECT_PREFIX='',
+ DEBUG=False,
)
def test_truncate_subject(self):
"""
@@ -279,8 +279,8 @@ def test_truncate_subject(self):
self.assertEqual(mail.outbox[0].subject, expected_subject)
@override_settings(
- ADMINS=(('admin', 'admin@example.com'),),
- DEBUG=False,
+ ADMINS=(('admin', 'admin@example.com'),),
+ DEBUG=False,
)
def test_uses_custom_email_backend(self):
"""
View
4 tests/mail/tests.py
@@ -324,8 +324,8 @@ def test_connection_arg(self):
connection = mail.get_connection('mail.custombackend.EmailBackend')
send_mass_mail([
- ('Subject1', 'Content1', 'from1@example.com', ['to1@example.com']),
- ('Subject2', 'Content2', 'from2@example.com', ['to2@example.com']),
+ ('Subject1', 'Content1', 'from1@example.com', ['to1@example.com']),
+ ('Subject2', 'Content2', 'from2@example.com', ['to2@example.com']),
], connection=connection)
self.assertEqual(mail.outbox, [])
self.assertEqual(len(connection.test_outbox), 2)
View
16 tests/managers_regress/tests.py
@@ -55,23 +55,23 @@ def test_managers(self):
# Since Child6 inherits from Child4, the corresponding rows from f1 and
# f2 also appear here. This is the expected result.
self.assertQuerysetEqual(Child4._default_manager.order_by('data'), [
- "<Child4: d1>",
- "<Child4: d2>",
- "<Child4: f1>",
- "<Child4: f2>"
+ "<Child4: d1>",
+ "<Child4: d2>",
+ "<Child4: f1>",
+ "<Child4: f2>"
]
)
self.assertQuerysetEqual(Child4.manager1.all(), [
- "<Child4: d1>",
- "<Child4: f1>"
+ "<Child4: d1>",
+ "<Child4: f1>"
],
ordered=False
)
self.assertQuerysetEqual(Child5._default_manager.all(), ["<Child5: fred>"])
self.assertQuerysetEqual(Child6._default_manager.all(), ["<Child6: f1>"])
self.assertQuerysetEqual(Child7._default_manager.order_by('name'), [
- "<Child7: barney>",
- "<Child7: fred>"
+ "<Child7: barney>",
+ "<Child7: fred>"
]
)
View
10 tests/many_to_one/tests.py
@@ -213,9 +213,9 @@ def test_selects(self):
self.assertQuerysetEqual(
Article.objects.filter(reporter__in=[self.r.id,self.r2.id]).distinct(),
[
- "<Article: John's second story>",
- "<Article: Paul's story>",
- "<Article: This is a test>",
+ "<Article: John's second story>",
+ "<Article: Paul's story>",
+ "<Article: This is a test>",
])
self.assertQuerysetEqual(
Article.objects.filter(reporter__in=[self.r,self.r2]).distinct(),
@@ -229,8 +229,8 @@ def test_selects(self):
# then converted into a query
self.assertQuerysetEqual(
Article.objects.filter(
- reporter__in=Reporter.objects.filter(first_name='John').values('pk').query
- ).distinct(),
+ reporter__in=Reporter.objects.filter(first_name='John').values('pk').query
+ ).distinct(),
[
"<Article: John's second story>",
"<Article: This is a test>",
View
10 tests/middleware_exceptions/tests.py
@@ -374,7 +374,7 @@ def test_process_response_middleware_null_view(self):
self._add_middleware(middleware)
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [
- "The view middleware_exceptions.views.null_view didn't return an HttpResponse object.",
+ "The view middleware_exceptions.views.null_view didn't return an HttpResponse object.",
],
ValueError())
@@ -391,7 +391,7 @@ def test_process_exception_middleware_null_view(self):
self._add_middleware(middleware)
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [
- "The view middleware_exceptions.views.null_view didn't return an HttpResponse object."
+ "The view middleware_exceptions.views.null_view didn't return an HttpResponse object."
],
ValueError())
@@ -685,8 +685,8 @@ def test_process_response_bad_middleware_null_view(self):
self._add_middleware(bad_middleware)
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [
- "The view middleware_exceptions.views.null_view didn't return an HttpResponse object.",
- 'Test Response Exception'
+ "The view middleware_exceptions.views.null_view didn't return an HttpResponse object.",
+ 'Test Response Exception'
])
# Check that the right middleware methods have been invoked
@@ -702,7 +702,7 @@ def test_process_exception_bad_middleware_null_view(self):
self._add_middleware(bad_middleware)
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [
- "The view middleware_exceptions.views.null_view didn't return an HttpResponse object."
+ "The view middleware_exceptions.views.null_view didn't return an HttpResponse object."
],
ValueError())
View
12 tests/model_fields/models.py
@@ -31,13 +31,13 @@ class Bar(models.Model):
class Whiz(models.Model):
CHOICES = (
('Group 1', (
- (1, 'First'),
- (2, 'Second'),
+ (1, 'First'),
+ (2, 'Second'),
)
),
('Group 2', (
- (3, 'Third'),
- (4, 'Fourth'),
+ (3, 'Third'),
+ (4, 'Fourth'),
)
),
(0, 'Other'),
@@ -218,9 +218,9 @@ class PersonTwoImages(models.Model):
height_field='mugshot_height',
width_field='mugshot_width')
headshot_height = models.PositiveSmallIntegerField(
- blank=True, null=True)
+ blank=True, null=True)
headshot_width = models.PositiveSmallIntegerField(
- blank=True, null=True)
+ blank=True, null=True)
headshot = TestImageField(blank=True, null=True,
storage=temp_storage, upload_to='tests',
height_field='headshot_height',
View
130 tests/model_forms/tests.py
@@ -679,12 +679,12 @@ def test_abstract_inherited