summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-01-28 07:35:27 -0500
committerTim Graham <timograham@gmail.com>2015-02-06 08:16:28 -0500
commit0ed7d155635da9f79d4dd67e4889087d3673c6da (patch)
treecf5c59b563f01774f32e20b3af8cb24a387fdc4d /tests
parent388d986b8a6bb1363dab9f53ea435dff4dfe92cb (diff)
downloaddjango-0ed7d155635da9f79d4dd67e4889087d3673c6da.tar.gz
Sorted imports with isort; refs #23860.
Diffstat (limited to 'tests')
-rw-r--r--tests/admin_autodiscover/admin.py1
-rw-r--r--tests/admin_changelist/admin.py5
-rw-r--r--tests/admin_changelist/tests.py29
-rw-r--r--tests/admin_changelist/urls.py1
-rw-r--r--tests/admin_checks/models.py4
-rw-r--r--tests/admin_checks/tests.py2
-rw-r--r--tests/admin_custom_urls/tests.py2
-rw-r--r--tests/admin_custom_urls/urls.py1
-rw-r--r--tests/admin_docs/tests.py4
-rw-r--r--tests/admin_docs/views.py2
-rw-r--r--tests/admin_filters/models.py4
-rw-r--r--tests/admin_filters/tests.py12
-rw-r--r--tests/admin_inlines/admin.py2
-rw-r--r--tests/admin_inlines/models.py3
-rw-r--r--tests/admin_inlines/tests.py21
-rw-r--r--tests/admin_inlines/urls.py1
-rw-r--r--tests/admin_ordering/tests.py8
-rw-r--r--tests/admin_registration/tests.py2
-rw-r--r--tests/admin_scripts/app_with_import/models.py2
-rw-r--r--tests/admin_scripts/complex_app/admin/foo.py1
-rw-r--r--tests/admin_scripts/tests.py18
-rw-r--r--tests/admin_scripts/urls.py1
-rw-r--r--tests/admin_utils/tests.py16
-rw-r--r--tests/admin_views/admin.py51
-rw-r--r--tests/admin_views/custom_has_permission_admin.py2
-rw-r--r--tests/admin_views/customadmin.py6
-rw-r--r--tests/admin_views/models.py4
-rw-r--r--tests/admin_views/tests.py66
-rw-r--r--tests/admin_views/urls.py3
-rw-r--r--tests/admin_widgets/models.py2
-rw-r--r--tests/admin_widgets/tests.py19
-rw-r--r--tests/admin_widgets/urls.py1
-rw-r--r--tests/aggregation/tests.py13
-rw-r--r--tests/aggregation_regress/models.py2
-rw-r--r--tests/aggregation_regress/tests.py10
-rw-r--r--tests/annotations/tests.py8
-rw-r--r--tests/app_loading/tests.py2
-rw-r--r--tests/apps/models.py1
-rw-r--r--tests/apps/tests.py9
-rw-r--r--tests/backends/models.py2
-rw-r--r--tests/backends/tests.py20
-rw-r--r--tests/basic/tests.py15
-rw-r--r--tests/builtin_server/tests.py3
-rw-r--r--tests/bulk_create/tests.py7
-rw-r--r--tests/cache/models.py3
-rw-r--r--tests/cache/tests.py35
-rw-r--r--tests/check_framework/test_model_field_deprecation.py2
-rw-r--r--tests/check_framework/test_security.py5
-rw-r--r--tests/check_framework/tests.py7
-rw-r--r--tests/choices/models.py1
-rw-r--r--tests/conditional_processing/tests.py1
-rw-r--r--tests/conditional_processing/urls.py1
-rw-r--r--tests/conditional_processing/views.py4
-rw-r--r--tests/contenttypes_tests/tests.py6
-rw-r--r--tests/context_processors/urls.py1
-rw-r--r--tests/csrf_tests/tests.py7
-rw-r--r--tests/custom_columns/tests.py2
-rw-r--r--tests/custom_lookups/tests.py6
-rw-r--r--tests/custom_managers/models.py4
-rw-r--r--tests/custom_managers/tests.py8
-rw-r--r--tests/custom_pk/models.py2
-rw-r--r--tests/custom_pk/tests.py4
-rw-r--r--tests/dates/tests.py2
-rw-r--r--tests/datetimes/tests.py11
-rw-r--r--tests/db_functions/tests.py6
-rw-r--r--tests/db_typecasts/tests.py1
-rw-r--r--tests/decorators/tests.py22
-rw-r--r--tests/defer/tests.py4
-rw-r--r--tests/defer_regress/tests.py10
-rw-r--r--tests/delete/tests.py11
-rw-r--r--tests/delete_regress/models.py2
-rw-r--r--tests/delete_regress/tests.py12
-rw-r--r--tests/dispatch/tests.py1
-rw-r--r--tests/distinct_on_fields/tests.py2
-rw-r--r--tests/expressions/tests.py18
-rw-r--r--tests/expressions_case/tests.py8
-rw-r--r--tests/extra_regress/tests.py4
-rw-r--r--tests/field_subclassing/fields.py4
-rw-r--r--tests/field_subclassing/models.py5
-rw-r--r--tests/field_subclassing/tests.py2
-rw-r--r--tests/file_storage/models.py2
-rw-r--r--tests/file_storage/tests.py15
-rw-r--r--tests/file_storage/urls.py1
-rw-r--r--tests/file_uploads/tests.py6
-rw-r--r--tests/file_uploads/urls.py1
-rw-r--r--tests/file_uploads/views.py2
-rw-r--r--tests/files/tests.py10
-rw-r--r--tests/fixtures/tests.py8
-rw-r--r--tests/fixtures_regress/tests.py33
-rw-r--r--tests/force_insert_update/tests.py7
-rw-r--r--tests/foreign_object/models.py3
-rw-r--r--tests/foreign_object/tests.py13
-rw-r--r--tests/forms_tests/models.py1
-rw-r--r--tests/forms_tests/tests/test_error_messages.py4
-rw-r--r--tests/forms_tests/tests/test_fields.py24
-rw-r--r--tests/forms_tests/tests/test_forms.py10
-rw-r--r--tests/forms_tests/tests/test_formsets.py6
-rw-r--r--tests/forms_tests/tests/test_input_formats.py5
-rw-r--r--tests/forms_tests/tests/test_media.py4
-rw-r--r--tests/forms_tests/tests/test_regressions.py2
-rw-r--r--tests/forms_tests/tests/test_utils.py6
-rw-r--r--tests/forms_tests/tests/test_widgets.py4
-rw-r--r--tests/forms_tests/tests/tests.py10
-rw-r--r--tests/forms_tests/urls.py1
-rw-r--r--tests/from_db_value/tests.py2
-rw-r--r--tests/generic_inline_admin/admin.py6
-rw-r--r--tests/generic_inline_admin/models.py2
-rw-r--r--tests/generic_inline_admin/tests.py3
-rw-r--r--tests/generic_relations/models.py2
-rw-r--r--tests/generic_relations/tests.py9
-rw-r--r--tests/generic_relations_regress/models.py5
-rw-r--r--tests/generic_relations_regress/tests.py11
-rw-r--r--tests/generic_views/test_base.py4
-rw-r--r--tests/generic_views/test_edit.py4
-rw-r--r--tests/generic_views/test_list.py4
-rw-r--r--tests/generic_views/urls.py4
-rw-r--r--tests/generic_views/views.py2
-rw-r--r--tests/get_earliest_or_latest/tests.py2
-rw-r--r--tests/get_object_or_404/tests.py4
-rw-r--r--tests/get_or_create/tests.py12
-rw-r--r--tests/handlers/tests.py9
-rw-r--r--tests/http_utils/tests.py6
-rw-r--r--tests/httpwrappers/tests.py17
-rw-r--r--tests/i18n/contenttypes/tests.py3
-rw-r--r--tests/i18n/patterns/tests.py8
-rw-r--r--tests/i18n/patterns/urls/default.py1
-rw-r--r--tests/i18n/patterns/urls/included.py1
-rw-r--r--tests/i18n/patterns/urls/namespace.py1
-rw-r--r--tests/i18n/patterns/urls/path_unused.py1
-rw-r--r--tests/i18n/patterns/urls/wrong.py1
-rw-r--r--tests/i18n/patterns/urls/wrong_namespace.py1
-rw-r--r--tests/i18n/test_compilation.py13
-rw-r--r--tests/i18n/test_extraction.py12
-rw-r--r--tests/i18n/tests.py45
-rw-r--r--tests/i18n/urls.py1
-rw-r--r--tests/indexes/models.py3
-rw-r--r--tests/inline_formsets/tests.py2
-rw-r--r--tests/introspection/tests.py2
-rw-r--r--tests/invalid_models_tests/test_models.py2
-rw-r--r--tests/invalid_models_tests/test_relative_fields.py2
-rw-r--r--tests/known_related_objects/tests.py2
-rw-r--r--tests/logging_tests/tests.py9
-rw-r--r--tests/logging_tests/views.py2
-rw-r--r--tests/lookup/tests.py2
-rw-r--r--tests/m2m_and_m2o/tests.py2
-rw-r--r--tests/m2m_intermediary/tests.py2
-rw-r--r--tests/m2m_regress/tests.py6
-rw-r--r--tests/m2m_signals/tests.py2
-rw-r--r--tests/m2m_through/tests.py8
-rw-r--r--tests/m2m_through_regress/tests.py7
-rw-r--r--tests/mail/tests.py17
-rw-r--r--tests/managers_regress/models.py4
-rw-r--r--tests/managers_regress/tests.py14
-rw-r--r--tests/many_to_one/tests.py10
-rw-r--r--tests/max_lengths/tests.py2
-rw-r--r--tests/middleware/test_security.py2
-rw-r--r--tests/middleware/tests.py14
-rw-r--r--tests/middleware/views.py10
-rw-r--r--tests/middleware_exceptions/tests.py2
-rw-r--r--tests/migrate_signals/tests.py3
-rw-r--r--tests/migration_test_data_persistence/migrations/0001_initial.py2
-rw-r--r--tests/migration_test_data_persistence/tests.py3
-rw-r--r--tests/migrations/deprecated_field_migrations/0001_initial.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_a/migrations/0001_initial.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_a/migrations/0002_a2.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_a/migrations/0003_a3.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_a/migrations/0004_a4.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_b/migrations/0001_initial.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_b/migrations/0002_b2.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_b/migrations/0003_b3.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_c/migrations/0001_initial.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_c/migrations/0002_c2.py2
-rw-r--r--tests/migrations/migrations_test_apps/lookuperror_c/migrations/0003_c3.py2
-rw-r--r--tests/migrations/migrations_test_apps/unmigrated_app/models.py1
-rw-r--r--tests/migrations/test_autodetector.py10
-rw-r--r--tests/migrations/test_commands.py2
-rw-r--r--tests/migrations/test_executor.py4
-rw-r--r--tests/migrations/test_graph.py4
-rw-r--r--tests/migrations/test_loader.py5
-rw-r--r--tests/migrations/test_migrations_custom_user/0001_initial.py2
-rw-r--r--tests/migrations/test_migrations_no_changes/0003_third.py2
-rw-r--r--tests/migrations/test_migrations_no_default/0001_initial.py2
-rw-r--r--tests/migrations/test_multidb.py12
-rw-r--r--tests/migrations/test_operations.py10
-rw-r--r--tests/migrations/test_optimizer.py5
-rw-r--r--tests/migrations/test_state.py9
-rw-r--r--tests/migrations/test_writer.py20
-rw-r--r--tests/model_fields/models.py22
-rw-r--r--tests/model_fields/test_field_flags.py6
-rw-r--r--tests/model_fields/test_uuid.py2
-rw-r--r--tests/model_fields/tests.py28
-rw-r--r--tests/model_forms/models.py3
-rw-r--r--tests/model_forms/tests.py30
-rw-r--r--tests/model_formsets/tests.py18
-rw-r--r--tests/model_formsets_regress/tests.py11
-rw-r--r--tests/model_inheritance/models.py1
-rw-r--r--tests/model_inheritance/same_model_name/models.py4
-rw-r--r--tests/model_inheritance/tests.py7
-rw-r--r--tests/model_inheritance_regress/tests.py14
-rw-r--r--tests/model_meta/models.py7
-rw-r--r--tests/model_meta/results.py4
-rw-r--r--tests/model_meta/test_legacy.py2
-rw-r--r--tests/model_meta/tests.py12
-rw-r--r--tests/model_options/models/tablespaces.py1
-rw-r--r--tests/model_options/test_default_related_name.py2
-rw-r--r--tests/model_options/test_tablespaces.py5
-rw-r--r--tests/model_package/tests.py4
-rw-r--r--tests/model_permalink/views.py10
-rw-r--r--tests/model_regress/models.py1
-rw-r--r--tests/model_regress/test_pickle.py2
-rw-r--r--tests/model_regress/tests.py10
-rw-r--r--tests/model_validation/tests.py4
-rw-r--r--tests/modeladmin/tests.py12
-rw-r--r--tests/multiple_database/models.py2
-rw-r--r--tests/multiple_database/tests.py4
-rw-r--r--tests/nested_foreign_keys/tests.py4
-rw-r--r--tests/null_fk/tests.py5
-rw-r--r--tests/null_fk_ordering/tests.py2
-rw-r--r--tests/null_queries/tests.py4
-rw-r--r--tests/one_to_one/tests.py8
-rw-r--r--tests/order_with_respect_to/tests.py5
-rw-r--r--tests/pagination/custom.py2
-rw-r--r--tests/pagination/tests.py9
-rw-r--r--tests/postgres_tests/array_default_migrations/0001_initial.py2
-rw-r--r--tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py2
-rw-r--r--tests/postgres_tests/migrations/0001_setup_extensions.py4
-rw-r--r--tests/postgres_tests/migrations/0002_create_test_models.py2
-rw-r--r--tests/postgres_tests/models.py4
-rw-r--r--tests/postgres_tests/test_array.py9
-rw-r--r--tests/postgres_tests/test_ranges.py10
-rw-r--r--tests/prefetch_related/models.py2
-rw-r--r--tests/prefetch_related/tests.py12
-rw-r--r--tests/proxy_model_inheritance/tests.py5
-rw-r--r--tests/proxy_models/admin.py2
-rw-r--r--tests/proxy_models/models.py1
-rw-r--r--tests/proxy_models/tests.py16
-rw-r--r--tests/proxy_models/urls.py1
-rw-r--r--tests/queries/tests.py36
-rw-r--r--tests/queryset_pickle/models.py2
-rw-r--r--tests/queryset_pickle/tests.py4
-rw-r--r--tests/raw_query/tests.py2
-rw-r--r--tests/requests/tests.py12
-rw-r--r--tests/resolve_url/tests.py4
-rw-r--r--tests/reverse_lookup/tests.py2
-rwxr-xr-xtests/runtests.py11
-rw-r--r--tests/schema/fields.py5
-rw-r--r--tests/schema/tests.py16
-rw-r--r--tests/select_for_update/tests.py8
-rw-r--r--tests/select_related/models.py6
-rw-r--r--tests/select_related/tests.py6
-rw-r--r--tests/select_related_onetoone/tests.py7
-rw-r--r--tests/select_related_regress/tests.py8
-rw-r--r--tests/serializers/tests.py26
-rw-r--r--tests/serializers_regress/models.py5
-rw-r--r--tests/serializers_regress/tests.py40
-rw-r--r--tests/servers/tests.py6
-rw-r--r--tests/servers/urls.py1
-rw-r--r--tests/servers/views.py1
-rw-r--r--tests/settings_tests/tests.py8
-rw-r--r--tests/shortcuts/tests.py2
-rw-r--r--tests/shortcuts/views.py3
-rw-r--r--tests/signing/tests.py2
-rw-r--r--tests/sites_framework/migrations/0001_initial.py2
-rw-r--r--tests/sites_framework/tests.py5
-rw-r--r--tests/staticfiles_tests/storage.py3
-rw-r--r--tests/staticfiles_tests/test_liveserver.py6
-rw-r--r--tests/staticfiles_tests/tests.py15
-rw-r--r--tests/string_lookup/tests.py3
-rw-r--r--tests/swappable_models/tests.py5
-rw-r--r--tests/syndication_tests/tests.py11
-rw-r--r--tests/syndication_tests/urls.py1
-rw-r--r--tests/template_backends/test_django.py6
-rw-r--r--tests/template_backends/test_jinja2.py4
-rw-r--r--tests/template_loader/tests.py7
-rw-r--r--tests/template_tests/alternate_urls.py1
-rw-r--r--tests/template_tests/filter_tests/test_autoescape.py2
-rw-r--r--tests/template_tests/filter_tests/test_date.py2
-rw-r--r--tests/template_tests/filter_tests/test_time.py2
-rw-r--r--tests/template_tests/filter_tests/test_timesince.py2
-rw-r--r--tests/template_tests/filter_tests/test_timeuntil.py2
-rw-r--r--tests/template_tests/syntax_tests/test_autoescape.py2
-rw-r--r--tests/template_tests/syntax_tests/test_basic.py3
-rw-r--r--tests/template_tests/syntax_tests/test_exceptions.py2
-rw-r--r--tests/template_tests/syntax_tests/test_extends.py1
-rw-r--r--tests/template_tests/syntax_tests/test_filter_syntax.py2
-rw-r--r--tests/template_tests/syntax_tests/test_if.py4
-rw-r--r--tests/template_tests/syntax_tests/test_include.py3
-rw-r--r--tests/template_tests/syntax_tests/test_numpy.py2
-rw-r--r--tests/template_tests/syntax_tests/test_ssi.py2
-rw-r--r--tests/template_tests/syntax_tests/test_static.py2
-rw-r--r--tests/template_tests/syntax_tests/test_url.py2
-rw-r--r--tests/template_tests/templatetags/bad_tag.py1
-rw-r--r--tests/template_tests/templatetags/inclusion.py1
-rw-r--r--tests/template_tests/test_context.py4
-rw-r--r--tests/template_tests/test_loaders.py17
-rw-r--r--tests/template_tests/test_parser.py4
-rw-r--r--tests/template_tests/test_response.py12
-rw-r--r--tests/template_tests/test_unicode.py4
-rw-r--r--tests/template_tests/tests.py13
-rw-r--r--tests/template_tests/urls.py2
-rw-r--r--tests/template_tests/utils.py3
-rw-r--r--tests/test_client/tests.py3
-rw-r--r--tests/test_client/urls.py1
-rw-r--r--tests/test_client/views.py6
-rw-r--r--tests/test_client_regress/models.py2
-rw-r--r--tests/test_client_regress/tests.py16
-rw-r--r--tests/test_client_regress/urls.py3
-rw-r--r--tests/test_client_regress/views.py2
-rw-r--r--tests/test_runner/test_discover_runner.py2
-rw-r--r--tests/test_runner/tests.py7
-rw-r--r--tests/test_utils/tests.py6
-rw-r--r--tests/test_utils/urls.py1
-rw-r--r--tests/timezones/tests.py31
-rw-r--r--tests/transactions/tests.py10
-rw-r--r--tests/unmanaged_models/models.py1
-rw-r--r--tests/unmanaged_models/tests.py2
-rw-r--r--tests/update/tests.py2
-rw-r--r--tests/update_only_fields/tests.py4
-rw-r--r--tests/urlpatterns_reverse/extra_urls.py3
-rw-r--r--tests/urlpatterns_reverse/included_named_urls.py3
-rw-r--r--tests/urlpatterns_reverse/included_named_urls2.py1
-rw-r--r--tests/urlpatterns_reverse/included_namespace_urls.py3
-rw-r--r--tests/urlpatterns_reverse/included_no_kwargs_urls.py1
-rw-r--r--tests/urlpatterns_reverse/included_urls.py1
-rw-r--r--tests/urlpatterns_reverse/included_urls2.py1
-rw-r--r--tests/urlpatterns_reverse/named_urls.py3
-rw-r--r--tests/urlpatterns_reverse/namespace_urls.py2
-rw-r--r--tests/urlpatterns_reverse/reverse_lazy_urls.py2
-rw-r--r--tests/urlpatterns_reverse/tests.py20
-rw-r--r--tests/urlpatterns_reverse/urlconf_inner.py2
-rw-r--r--tests/urlpatterns_reverse/urlconf_outer.py3
-rw-r--r--tests/urlpatterns_reverse/urls.py3
-rw-r--r--tests/urlpatterns_reverse/urls_error_handlers_callables.py1
-rw-r--r--tests/urlpatterns_reverse/urls_without_full_import.py3
-rw-r--r--tests/urlpatterns_reverse/views.py5
-rw-r--r--tests/user_commands/tests.py4
-rw-r--r--tests/utils_tests/test_archive.py3
-rw-r--r--tests/utils_tests/test_autoreload.py4
-rw-r--r--tests/utils_tests/test_baseconv.py4
-rw-r--r--tests/utils_tests/test_datastructures.py6
-rw-r--r--tests/utils_tests/test_dateformat.py9
-rw-r--r--tests/utils_tests/test_dateparse.py6
-rw-r--r--tests/utils_tests/test_datetime_safe.py5
-rw-r--r--tests/utils_tests/test_decorators.py2
-rw-r--r--tests/utils_tests/test_encoding.py6
-rw-r--r--tests/utils_tests/test_functional.py2
-rw-r--r--tests/utils_tests/test_html.py2
-rw-r--r--tests/utils_tests/test_http.py5
-rw-r--r--tests/utils_tests/test_ipv6.py2
-rw-r--r--tests/utils_tests/test_module/another_bad_module.py1
-rw-r--r--tests/utils_tests/test_module/another_good_module.py1
-rw-r--r--tests/utils_tests/test_module_loading.py7
-rw-r--r--tests/utils_tests/test_safestring.py12
-rw-r--r--tests/utils_tests/test_termcolors.py6
-rw-r--r--tests/utils_tests/test_timesince.py2
-rw-r--r--tests/utils_tests/test_timezone.py7
-rw-r--r--tests/validation/test_unique.py7
-rw-r--r--tests/validation/tests.py6
-rw-r--r--tests/validators/tests.py5
-rw-r--r--tests/view_tests/default_urls.py1
-rw-r--r--tests/view_tests/generic_urls.py2
-rw-r--r--tests/view_tests/templatetags/debugtags.py1
-rw-r--r--tests/view_tests/tests/test_csrf.py2
-rw-r--r--tests/view_tests/tests/test_debug.py13
-rw-r--r--tests/view_tests/tests/test_i18n.py7
-rw-r--r--tests/view_tests/tests/test_static.py2
-rw-r--r--tests/view_tests/urls.py3
-rw-r--r--tests/view_tests/views.py16
-rw-r--r--tests/wsgi/urls.py2
369 files changed, 1184 insertions, 1094 deletions
diff --git a/tests/admin_autodiscover/admin.py b/tests/admin_autodiscover/admin.py
index e7d1a080c2..e2b941ac93 100644
--- a/tests/admin_autodiscover/admin.py
+++ b/tests/admin_autodiscover/admin.py
@@ -2,6 +2,5 @@ from django.contrib import admin
from .models import Story
-
admin.site.register(Story)
raise Exception("Bad admin module")
diff --git a/tests/admin_changelist/admin.py b/tests/admin_changelist/admin.py
index b2bd578e80..926a45d518 100644
--- a/tests/admin_changelist/admin.py
+++ b/tests/admin_changelist/admin.py
@@ -1,10 +1,9 @@
from django.contrib import admin
-from django.core.paginator import Paginator
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
+from django.core.paginator import Paginator
-from .models import Event, Child, Parent, Swallow
-
+from .models import Child, Event, Parent, Swallow
site = admin.AdminSite(name="admin")
diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py
index 16b56aef86..8647ff7e2c 100644
--- a/tests/admin_changelist/tests.py
+++ b/tests/admin_changelist/tests.py
@@ -5,25 +5,28 @@ import datetime
from django.contrib import admin
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.templatetags.admin_list import pagination
-from django.contrib.admin.views.main import ChangeList, SEARCH_VAR, ALL_VAR
from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
+from django.contrib.admin.views.main import ALL_VAR, SEARCH_VAR, ChangeList
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.template import Context, Template
from django.test import TestCase, override_settings
from django.test.client import RequestFactory
-from django.utils import formats
-from django.utils import six
-
-from .admin import (ChildAdmin, QuartetAdmin, BandAdmin, ChordsBandAdmin,
- GroupAdmin, ParentAdmin, DynamicListDisplayChildAdmin,
- DynamicListDisplayLinksChildAdmin, CustomPaginationAdmin,
- FilteredChildAdmin, CustomPaginator, site as custom_site,
- SwallowAdmin, DynamicListFilterChildAdmin, InvitationAdmin,
- DynamicSearchFieldsChildAdmin, NoListDisplayLinksParentAdmin)
-from .models import (Event, Child, Parent, Genre, Band, Musician, Group,
- Quartet, Membership, ChordsMusician, ChordsBand, Invitation, Swallow,
- UnorderedObject, OrderedObject, CustomIdUser)
+from django.utils import formats, six
+
+from .admin import (
+ BandAdmin, ChildAdmin, ChordsBandAdmin, CustomPaginationAdmin,
+ CustomPaginator, DynamicListDisplayChildAdmin,
+ DynamicListDisplayLinksChildAdmin, DynamicListFilterChildAdmin,
+ DynamicSearchFieldsChildAdmin, FilteredChildAdmin, GroupAdmin,
+ InvitationAdmin, NoListDisplayLinksParentAdmin, ParentAdmin, QuartetAdmin,
+ SwallowAdmin, site as custom_site,
+)
+from .models import (
+ Band, Child, ChordsBand, ChordsMusician, CustomIdUser, Event, Genre, Group,
+ Invitation, Membership, Musician, OrderedObject, Parent, Quartet, Swallow,
+ UnorderedObject,
+)
@override_settings(ROOT_URLCONF="admin_changelist.urls")
diff --git a/tests/admin_changelist/urls.py b/tests/admin_changelist/urls.py
index b73893b2ae..4da326ccc4 100644
--- a/tests/admin_changelist/urls.py
+++ b/tests/admin_changelist/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import include, url
from . import admin
-
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
]
diff --git a/tests/admin_checks/models.py b/tests/admin_checks/models.py
index 6c34d95ab8..dbb5931c8c 100644
--- a/tests/admin_checks/models.py
+++ b/tests/admin_checks/models.py
@@ -2,10 +2,10 @@
Tests of ModelAdmin system checks logic.
"""
+from django.contrib.contenttypes.fields import GenericForeignKey
+from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
-from django.contrib.contenttypes.models import ContentType
-from django.contrib.contenttypes.fields import GenericForeignKey
class Album(models.Model):
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py
index 4f5bd5e48a..864609a6c7 100644
--- a/tests/admin_checks/tests.py
+++ b/tests/admin_checks/tests.py
@@ -6,7 +6,7 @@ from django.contrib.contenttypes.admin import GenericStackedInline
from django.core import checks
from django.test import TestCase, override_settings
-from .models import Song, Book, Album, TwoAlbumFKAndAnE, City, State, Influence
+from .models import Album, Book, City, Influence, Song, State, TwoAlbumFKAndAnE
class SongForm(forms.ModelForm):
diff --git a/tests/admin_custom_urls/tests.py b/tests/admin_custom_urls/tests.py
index 56827c08c4..3260bc603c 100644
--- a/tests/admin_custom_urls/tests.py
+++ b/tests/admin_custom_urls/tests.py
@@ -5,7 +5,7 @@ from django.core.urlresolvers import reverse
from django.template.response import TemplateResponse
from django.test import TestCase, override_settings
-from .models import Action, Person, Car
+from .models import Action, Car, Person
@override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
diff --git a/tests/admin_custom_urls/urls.py b/tests/admin_custom_urls/urls.py
index 1d14a09161..eb91d283d4 100644
--- a/tests/admin_custom_urls/urls.py
+++ b/tests/admin_custom_urls/urls.py
@@ -1,7 +1,6 @@
from django.conf.urls import include, url
from django.contrib import admin
-
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
]
diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py
index 5ba0e2a0bc..60e35569d9 100644
--- a/tests/admin_docs/tests.py
+++ b/tests/admin_docs/tests.py
@@ -2,14 +2,14 @@ import sys
import unittest
from django.conf import settings
-from django.contrib.sites.models import Site
from django.contrib.admindocs import utils
from django.contrib.admindocs.views import get_return_data_type
from django.contrib.auth.models import User
+from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.test import TestCase, modify_settings, override_settings
-from .models import Person, Company
+from .models import Company, Person
@override_settings(
diff --git a/tests/admin_docs/views.py b/tests/admin_docs/views.py
index 9a2f81d45c..31d253f7e2 100644
--- a/tests/admin_docs/views.py
+++ b/tests/admin_docs/views.py
@@ -1,7 +1,7 @@
+from django.contrib.admindocs.middleware import XViewMiddleware
from django.http import HttpResponse
from django.utils.decorators import decorator_from_middleware
from django.views.generic import View
-from django.contrib.admindocs.middleware import XViewMiddleware
xview_dec = decorator_from_middleware(XViewMiddleware)
diff --git a/tests/admin_filters/models.py b/tests/admin_filters/models.py
index 36e098e62a..588d90ea48 100644
--- a/tests/admin_filters/models.py
+++ b/tests/admin_filters/models.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
from django.contrib.auth.models import User
-from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
+from django.contrib.contenttypes.fields import (
+ GenericForeignKey, GenericRelation,
+)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py
index 2b9836f5d1..f01f9dff10 100644
--- a/tests/admin_filters/tests.py
+++ b/tests/admin_filters/tests.py
@@ -2,17 +2,19 @@ from __future__ import unicode_literals
import datetime
-from django.contrib.admin import (site, ModelAdmin, SimpleListFilter,
- BooleanFieldListFilter, AllValuesFieldListFilter, RelatedOnlyFieldListFilter)
+from django.contrib.admin import (
+ AllValuesFieldListFilter, BooleanFieldListFilter, ModelAdmin,
+ RelatedOnlyFieldListFilter, SimpleListFilter, site,
+)
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
-from django.test import TestCase, RequestFactory, override_settings
-from django.utils.encoding import force_text
+from django.test import RequestFactory, TestCase, override_settings
from django.utils import six
+from django.utils.encoding import force_text
-from .models import Book, Department, Employee, Bookmark, TaggedItem
+from .models import Book, Bookmark, Department, Employee, TaggedItem
def select_by(dictlist, key, value):
diff --git a/tests/admin_inlines/admin.py b/tests/admin_inlines/admin.py
index 4fc7478132..136cf3a96c 100644
--- a/tests/admin_inlines/admin.py
+++ b/tests/admin_inlines/admin.py
@@ -1,5 +1,5 @@
-from django.contrib import admin
from django import forms
+from django.contrib import admin
from .models import (
Author, BinaryTree, CapoFamiglia, Chapter, ChildModel1, ChildModel2,
diff --git a/tests/admin_inlines/models.py b/tests/admin_inlines/models.py
index 0ad59a07bf..d1003f607a 100644
--- a/tests/admin_inlines/models.py
+++ b/tests/admin_inlines/models.py
@@ -3,11 +3,12 @@ Testing of admin inline formsets.
"""
from __future__ import unicode_literals
+
import random
-from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
+from django.db import models
from django.utils.encoding import python_2_unicode_compatible
diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
index fe481994d0..78889be30e 100644
--- a/tests/admin_inlines/tests.py
+++ b/tests/admin_inlines/tests.py
@@ -2,21 +2,22 @@ from __future__ import unicode_literals
import warnings
-from django.contrib.admin import TabularInline, ModelAdmin
-from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
+from django.contrib.admin import ModelAdmin, TabularInline
from django.contrib.admin.helpers import InlineAdminForm
-from django.contrib.auth.models import User, Permission
+from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
+from django.contrib.auth.models import Permission, User
from django.contrib.contenttypes.models import ContentType
-from django.test import TestCase, override_settings, RequestFactory
+from django.test import RequestFactory, TestCase, override_settings
from django.utils.encoding import force_text
-# local test models
from .admin import InnerInline, site as admin_site
-from .models import (Holder, Inner, Holder2, Inner2, Holder3, Inner3, Person,
- OutfitItem, Fashionista, Teacher, Parent, Child, Author, Book, Profile,
- ProfileCollection, ParentModelWithCustomPk, ChildModel1, ChildModel2,
- Sighting, Novel, Chapter, FootNote, BinaryTree, SomeParentModel,
- SomeChildModel, Poll, Question, Inner4Stacked, Inner4Tabular, Holder4)
+from .models import (
+ Author, BinaryTree, Book, Chapter, Child, ChildModel1, ChildModel2,
+ Fashionista, FootNote, Holder, Holder2, Holder3, Holder4, Inner, Inner2,
+ Inner3, Inner4Stacked, Inner4Tabular, Novel, OutfitItem, Parent,
+ ParentModelWithCustomPk, Person, Poll, Profile, ProfileCollection,
+ Question, Sighting, SomeChildModel, SomeParentModel, Teacher,
+)
INLINE_CHANGELINK_HTML = 'class="inlinechangelink">Change</a>'
diff --git a/tests/admin_inlines/urls.py b/tests/admin_inlines/urls.py
index b73893b2ae..4da326ccc4 100644
--- a/tests/admin_inlines/urls.py
+++ b/tests/admin_inlines/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import include, url
from . import admin
-
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
]
diff --git a/tests/admin_ordering/tests.py b/tests/admin_ordering/tests.py
index 1bd06e6e5a..e984395469 100644
--- a/tests/admin_ordering/tests.py
+++ b/tests/admin_ordering/tests.py
@@ -3,10 +3,12 @@ from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.admin.options import ModelAdmin
from django.contrib.auth.models import User
-from django.test import TestCase, RequestFactory
+from django.test import RequestFactory, TestCase
-from .models import (Band, Song, SongInlineDefaultOrdering,
- SongInlineNewOrdering, DynOrderingBandAdmin)
+from .models import (
+ Band, DynOrderingBandAdmin, Song, SongInlineDefaultOrdering,
+ SongInlineNewOrdering,
+)
class MockRequest(object):
diff --git a/tests/admin_registration/tests.py b/tests/admin_registration/tests.py
index 98a509fc42..355aa3960c 100644
--- a/tests/admin_registration/tests.py
+++ b/tests/admin_registration/tests.py
@@ -6,7 +6,7 @@ from django.contrib.admin.sites import site
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
-from .models import Person, Place, Location, Traveler
+from .models import Location, Person, Place, Traveler
class NameAdmin(admin.ModelAdmin):
diff --git a/tests/admin_scripts/app_with_import/models.py b/tests/admin_scripts/app_with_import/models.py
index 89125c386f..3741541628 100644
--- a/tests/admin_scripts/app_with_import/models.py
+++ b/tests/admin_scripts/app_with_import/models.py
@@ -1,5 +1,5 @@
-from django.db import models
from django.contrib.auth.models import User
+from django.db import models
# Regression for #13368. This is an example of a model
diff --git a/tests/admin_scripts/complex_app/admin/foo.py b/tests/admin_scripts/complex_app/admin/foo.py
index 09ceba05aa..adf22b330c 100644
--- a/tests/admin_scripts/complex_app/admin/foo.py
+++ b/tests/admin_scripts/complex_app/admin/foo.py
@@ -2,5 +2,4 @@ from django.contrib import admin
from ..models.foo import Foo
-
admin.site.register(Foo)
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index c7603e3914..319bd47407 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
"""
A series of tests to establish that the command-line management tools work as
-advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE
-and default settings.py files.
+advertised - especially with regards to the handling of the
+DJANGO_SETTINGS_MODULE and default settings.py files.
"""
+from __future__ import unicode_literals
import codecs
import os
@@ -19,13 +18,14 @@ import unittest
import django
from django import conf, get_version
from django.conf import settings
-from django.core.management import BaseCommand, CommandError, call_command, color
-from django.utils.encoding import force_text
-from django.utils._os import npath, upath
-from django.utils.six import StringIO
+from django.core.management import (
+ BaseCommand, CommandError, call_command, color,
+)
from django.test import LiveServerTestCase, TestCase, mock, override_settings
from django.test.runner import DiscoverRunner
-
+from django.utils._os import npath, upath
+from django.utils.encoding import force_text
+from django.utils.six import StringIO
test_dir = os.path.realpath(os.path.join(os.environ['DJANGO_TEST_TEMP_DIR'], 'test_project'))
if not os.path.exists(test_dir):
diff --git a/tests/admin_scripts/urls.py b/tests/admin_scripts/urls.py
index b3f4eef15b..d258641fbe 100644
--- a/tests/admin_scripts/urls.py
+++ b/tests/admin_scripts/urls.py
@@ -1,4 +1,5 @@
import os
+
from django.conf.urls import url
from django.utils._os import upath
from django.views.static import serve
diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py
index 01710e51ce..5720fbb64d 100644
--- a/tests/admin_utils/tests.py
+++ b/tests/admin_utils/tests.py
@@ -2,20 +2,24 @@ from __future__ import unicode_literals
from datetime import datetime
+from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import helpers
-from django.contrib.admin.utils import (display_for_field, flatten,
- flatten_fieldsets, label_for_field, lookup_field, NestedObjects)
+from django.contrib.admin.utils import (
+ NestedObjects, display_for_field, flatten, flatten_fieldsets,
+ label_for_field, lookup_field,
+)
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
-from django.db import models, DEFAULT_DB_ALIAS
-from django import forms
+from django.db import DEFAULT_DB_ALIAS, models
from django.test import TestCase
+from django.utils import six
from django.utils.formats import localize
from django.utils.safestring import mark_safe
-from django.utils import six
-from .models import Site, Article, Count, Event, Location, EventGuide, Vehicle, Car
+from .models import (
+ Article, Car, Count, Event, EventGuide, Location, Site, Vehicle,
+)
class NestedObjectsTests(TestCase):
diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
index dd49a0c0da..c044a6ac21 100644
--- a/tests/admin_views/admin.py
+++ b/tests/admin_views/admin.py
@@ -1,45 +1,46 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-import tempfile
import os
+import tempfile
from wsgiref.util import FileWrapper
from django import forms
+from django.conf.urls import url
from django.contrib import admin
+from django.contrib.admin import BooleanFieldListFilter
from django.contrib.admin.views.main import ChangeList
+from django.contrib.auth.admin import GroupAdmin, UserAdmin
+from django.contrib.auth.models import Group, User
from django.core.exceptions import ValidationError
from django.core.files.storage import FileSystemStorage
from django.core.mail import EmailMessage
-from django.conf.urls import url
from django.forms.models import BaseModelFormSet
from django.http import HttpResponse, StreamingHttpResponse
-from django.contrib.admin import BooleanFieldListFilter
from django.utils.safestring import mark_safe
from django.utils.six import StringIO
from .models import (
- Article, Chapter, Child, Parent, Picture, Widget,
- DooHickey, Grommet, Whatsit, FancyDoodad, Category, Link,
- PrePopulatedPost, PrePopulatedSubPost, CustomArticle, Section,
- ModelWithStringPrimaryKey, Color, Thing, Actor, Inquisition, Sketch,
- Person, Persona, FooAccount, BarAccount, Subscriber, ExternalSubscriber,
- OldSubscriber, Podcast, Vodcast, EmptyModel, Fabric, Gallery, Language,
- Recommendation, Recommender, Collector, Post, Gadget, Villain,
- SuperVillain, Plot, PlotDetails, CyclicOne, CyclicTwo, WorkHour,
- Reservation, FoodDelivery, RowLevelChangePermissionModel, Paper,
- CoverLetter, Story, OtherStory, Book, Promo, ChapterXtra1, Pizza, Topping,
- Album, Question, Answer, ComplexSortedPerson, PluggableSearchPerson,
- PrePopulatedPostLargeSlug, AdminOrderedField, AdminOrderedModelMethod,
- AdminOrderedAdminMethod, AdminOrderedCallable, Report, Color2,
- UnorderedObject, MainPrepopulated, RelatedPrepopulated, UndeletableObject,
- UnchangeableObject, UserMessenger, Simple, Choice, ShortMessage, Telegram,
- FilteredManager, EmptyModelHidden, EmptyModelVisible, EmptyModelMixin,
- State, City, Restaurant, Worker, ParentWithDependentChildren,
- DependentChild, StumpJoke, FieldOverridePost, FunkyTag,
- ReferencedByParent, ChildOfReferer, ReferencedByInline,
- InlineReference, InlineReferer, Recipe, Ingredient, NotReferenced,
- ExplicitlyProvidedPK, ImplicitlyGeneratedPK,
+ Actor, AdminOrderedAdminMethod, AdminOrderedCallable, AdminOrderedField,
+ AdminOrderedModelMethod, Album, Answer, Article, BarAccount, Book,
+ Category, Chapter, ChapterXtra1, Child, ChildOfReferer, Choice, City,
+ Collector, Color, Color2, ComplexSortedPerson, CoverLetter, CustomArticle,
+ CyclicOne, CyclicTwo, DependentChild, DooHickey, EmptyModel,
+ EmptyModelHidden, EmptyModelMixin, EmptyModelVisible, ExplicitlyProvidedPK,
+ ExternalSubscriber, Fabric, FancyDoodad, FieldOverridePost,
+ FilteredManager, FooAccount, FoodDelivery, FunkyTag, Gadget, Gallery,
+ Grommet, ImplicitlyGeneratedPK, Ingredient, InlineReference, InlineReferer,
+ Inquisition, Language, Link, MainPrepopulated, ModelWithStringPrimaryKey,
+ NotReferenced, OldSubscriber, OtherStory, Paper, Parent,
+ ParentWithDependentChildren, Person, Persona, Picture, Pizza, Plot,
+ PlotDetails, PluggableSearchPerson, Podcast, Post, PrePopulatedPost,
+ PrePopulatedPostLargeSlug, PrePopulatedSubPost, Promo, Question, Recipe,
+ Recommendation, Recommender, ReferencedByInline, ReferencedByParent,
+ RelatedPrepopulated, Report, Reservation, Restaurant,
+ RowLevelChangePermissionModel, Section, ShortMessage, Simple, Sketch,
+ State, Story, StumpJoke, Subscriber, SuperVillain, Telegram, Thing,
+ Topping, UnchangeableObject, UndeletableObject, UnorderedObject,
+ UserMessenger, Villain, Vodcast, Whatsit, Widget, Worker, WorkHour,
)
@@ -969,8 +970,6 @@ site.register(ExplicitlyProvidedPK, GetFormsetsArgumentCheckingAdmin)
site.register(ImplicitlyGeneratedPK, GetFormsetsArgumentCheckingAdmin)
# Register core models we need in our tests
-from django.contrib.auth.models import User, Group
-from django.contrib.auth.admin import UserAdmin, GroupAdmin
site.register(User, UserAdmin)
site.register(Group, GroupAdmin)
diff --git a/tests/admin_views/custom_has_permission_admin.py b/tests/admin_views/custom_has_permission_admin.py
index 6c15a9805a..a578895b5a 100644
--- a/tests/admin_views/custom_has_permission_admin.py
+++ b/tests/admin_views/custom_has_permission_admin.py
@@ -7,7 +7,7 @@ from django.contrib import admin
from django.contrib.auth import get_permission_codename
from django.contrib.auth.forms import AuthenticationForm
-from . import models, admin as base_admin
+from . import admin as base_admin, models
PERMISSION_NAME = 'admin_views.%s' % get_permission_codename('change', models.Article._meta)
diff --git a/tests/admin_views/customadmin.py b/tests/admin_views/customadmin.py
index 3276a3091d..7941b7c897 100644
--- a/tests/admin_views/customadmin.py
+++ b/tests/admin_views/customadmin.py
@@ -5,11 +5,11 @@ from __future__ import unicode_literals
from django.conf.urls import url
from django.contrib import admin
-from django.http import HttpResponse
-from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
+from django.contrib.auth.models import User
+from django.http import HttpResponse
-from . import models, forms, admin as base_admin
+from . import admin as base_admin, forms, models
class Admin2(admin.AdminSite):
diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py
index 8a78514cec..c4d247d56c 100644
--- a/tests/admin_views/models.py
+++ b/tests/admin_views/models.py
@@ -2,12 +2,12 @@
from __future__ import unicode_literals
import datetime
-import tempfile
import os
+import tempfile
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.core.files.storage import FileSystemStorage
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index de3861d551..7faa2d4e4f 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -1,61 +1,61 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+import datetime
import os
import re
-import datetime
import unittest
-from django.core import mail
-from django.core.checks import Error
-from django.core.files import temp as tempfile
-from django.core.urlresolvers import (NoReverseMatch,
- get_script_prefix, resolve, reverse, set_script_prefix)
-# Register auth models with the admin.
-from django.contrib.auth import get_permission_codename
from django.contrib.admin import ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
-from django.contrib.admin.models import LogEntry, DELETION
+from django.contrib.admin.models import DELETION, LogEntry
from django.contrib.admin.options import TO_FIELD_VAR
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
from django.contrib.admin.utils import quote
from django.contrib.admin.views.main import IS_POPUP_VAR
-from django.contrib.auth import REDIRECT_FIELD_NAME
-from django.contrib.auth.models import Group, User, Permission
+from django.contrib.auth import REDIRECT_FIELD_NAME, get_permission_codename
+from django.contrib.auth.models import Group, Permission, User
from django.contrib.contenttypes.models import ContentType
from django.contrib.staticfiles.storage import staticfiles_storage
+from django.core import mail
+from django.core.checks import Error
+from django.core.files import temp as tempfile
+from django.core.urlresolvers import (
+ NoReverseMatch, get_script_prefix, resolve, reverse, set_script_prefix,
+)
from django.forms.utils import ErrorList
from django.template.response import TemplateResponse
-from django.test import TestCase, skipUnlessDBFeature
+from django.test import (
+ TestCase, modify_settings, override_settings, skipUnlessDBFeature,
+)
from django.test.utils import patch_logger
-from django.test import modify_settings, override_settings
-from django.utils import formats
-from django.utils import translation
+from django.utils import formats, six, translation
+from django.utils._os import upath
from django.utils.cache import get_max_age
-from django.utils.encoding import iri_to_uri, force_bytes, force_text
+from django.utils.encoding import force_bytes, force_text, iri_to_uri
from django.utils.html import escape
from django.utils.http import urlencode
from django.utils.six.moves.urllib.parse import parse_qsl, urljoin, urlparse
-from django.utils._os import upath
-from django.utils import six
-
-# local test models
-from .models import (Article, BarAccount, CustomArticle, EmptyModel, FooAccount,
- Gallery, ModelWithStringPrimaryKey, Person, Persona, Picture, Podcast,
- Section, Subscriber, Vodcast, Language, Collector, Widget, Grommet,
- DooHickey, FancyDoodad, Whatsit, Category, Post, Plot, FunkyTag, Chapter,
- Book, Promo, WorkHour, Employee, Question, Answer, Inquisition, Actor,
- FoodDelivery, RowLevelChangePermissionModel, Paper, CoverLetter, Story,
- OtherStory, ComplexSortedPerson, PluggableSearchPerson, Parent, Child, AdminOrderedField,
- AdminOrderedModelMethod, AdminOrderedAdminMethod, AdminOrderedCallable,
- Report, MainPrepopulated, RelatedPrepopulated, UnorderedObject,
- Simple, UndeletableObject, UnchangeableObject, Choice, ShortMessage,
- Telegram, Pizza, Topping, FilteredManager, City, Restaurant, Worker,
- ParentWithDependentChildren, Character, FieldOverridePost, Color2)
+
from . import customadmin
-from .admin import site, site2, CityAdmin
+from .admin import CityAdmin, site, site2
+from .models import (
+ Actor, AdminOrderedAdminMethod, AdminOrderedCallable, AdminOrderedField,
+ AdminOrderedModelMethod, Answer, Article, BarAccount, Book, Category,
+ Chapter, Character, Child, Choice, City, Collector, Color2,
+ ComplexSortedPerson, CoverLetter, CustomArticle, DooHickey, Employee,
+ EmptyModel, FancyDoodad, FieldOverridePost, FilteredManager, FooAccount,
+ FoodDelivery, FunkyTag, Gallery, Grommet, Inquisition, Language,
+ MainPrepopulated, ModelWithStringPrimaryKey, OtherStory, Paper, Parent,
+ ParentWithDependentChildren, Person, Persona, Picture, Pizza, Plot,
+ PluggableSearchPerson, Podcast, Post, Promo, Question, RelatedPrepopulated,
+ Report, Restaurant, RowLevelChangePermissionModel, Section, ShortMessage,
+ Simple, Story, Subscriber, Telegram, Topping, UnchangeableObject,
+ UndeletableObject, UnorderedObject, Vodcast, Whatsit, Widget, Worker,
+ WorkHour,
+)
ERROR_MESSAGE = "Please enter the correct username and password \
diff --git a/tests/admin_views/urls.py b/tests/admin_views/urls.py
index 6c2442d520..17dc02d102 100644
--- a/tests/admin_views/urls.py
+++ b/tests/admin_views/urls.py
@@ -1,7 +1,6 @@
from django.conf.urls import include, url
-from . import views, customadmin, custom_has_permission_admin, admin
-
+from . import admin, custom_has_permission_admin, customadmin, views
urlpatterns = [
url(r'^test_admin/admin/doc/', include('django.contrib.admindocs.urls')),
diff --git a/tests/admin_widgets/models.py b/tests/admin_widgets/models.py
index 5d65dcd174..5f990bdce3 100644
--- a/tests/admin_widgets/models.py
+++ b/tests/admin_widgets/models.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
-from django.db import models
from django.contrib.auth.models import User
+from django.db import models
from django.utils.encoding import python_2_unicode_compatible
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
index 37ca50794c..8949aecd22 100644
--- a/tests/admin_widgets/tests.py
+++ b/tests/admin_widgets/tests.py
@@ -1,17 +1,12 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from datetime import datetime, timedelta
import gettext
-from importlib import import_module
import os
+from datetime import datetime, timedelta
+from importlib import import_module
from unittest import TestCase, skipIf
-try:
- import pytz
-except ImportError:
- pytz = None
-
from django import forms
from django.conf import settings
from django.contrib import admin
@@ -20,14 +15,16 @@ from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
from django.core.files.storage import default_storage
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models import CharField, DateField
-from django.test import TestCase as DjangoTestCase
-from django.test import override_settings
-from django.utils import six
-from django.utils import translation
+from django.test import TestCase as DjangoTestCase, override_settings
+from django.utils import six, translation
from . import models
from .widgetadmin import site as widget_admin_site
+try:
+ import pytz
+except ImportError:
+ pytz = None
admin_static_prefix = lambda: {
'ADMIN_STATIC_PREFIX': "%sadmin/" % settings.STATIC_URL,
diff --git a/tests/admin_widgets/urls.py b/tests/admin_widgets/urls.py
index 3b3e9b1488..7f4721c57e 100644
--- a/tests/admin_widgets/urls.py
+++ b/tests/admin_widgets/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import include, url
from . import widgetadmin
-
urlpatterns = [
url(r'^', include(widgetadmin.site.urls)),
]
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index 7e500dfb0e..9282c7e10c 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -1,22 +1,21 @@
from __future__ import unicode_literals
import datetime
-from decimal import Decimal
import re
+from decimal import Decimal
from django.core.exceptions import FieldError
from django.db import connection
from django.db.models import (
- Avg, Sum, Count, Max, Min,
- Aggregate, F, Value, Func,
- IntegerField, FloatField, DecimalField)
+ F, Aggregate, Avg, Count, DecimalField, FloatField, Func, IntegerField,
+ Max, Min, Sum, Value,
+)
from django.test import TestCase, ignore_warnings
-from django.test.utils import Approximate
-from django.test.utils import CaptureQueriesContext
+from django.test.utils import Approximate, CaptureQueriesContext
from django.utils import six, timezone
from django.utils.deprecation import RemovedInDjango20Warning
-from .models import Author, Publisher, Book, Store
+from .models import Author, Book, Publisher, Store
class BaseAggregateTestCase(TestCase):
diff --git a/tests/aggregation_regress/models.py b/tests/aggregation_regress/models.py
index e8714668ba..2cad0a5486 100644
--- a/tests/aggregation_regress/models.py
+++ b/tests/aggregation_regress/models.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
index e7a457fb58..530f2e7894 100644
--- a/tests/aggregation_regress/tests.py
+++ b/tests/aggregation_regress/tests.py
@@ -5,15 +5,17 @@ import pickle
from decimal import Decimal
from operator import attrgetter
-from django.core.exceptions import FieldError
from django.contrib.contenttypes.models import ContentType
-from django.db.models import Count, Max, Avg, Sum, StdDev, Variance, F, Q
+from django.core.exceptions import FieldError
+from django.db.models import F, Q, Avg, Count, Max, StdDev, Sum, Variance
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import Approximate
from django.utils import six
-from .models import (Author, Book, Publisher, Clues, Entries, HardbackBook,
- ItemTag, WithManualPK, Alfa, Bravo, Charlie)
+from .models import (
+ Alfa, Author, Book, Bravo, Charlie, Clues, Entries, HardbackBook, ItemTag,
+ Publisher, WithManualPK,
+)
class AggregationTests(TestCase):
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index 90a9c13048..2bf441716b 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -1,16 +1,16 @@
from __future__ import unicode_literals
+
import datetime
from decimal import Decimal
from django.core.exceptions import FieldDoesNotExist, FieldError
from django.db.models import (
- Sum, Count,
- F, Value, Func,
- IntegerField, BooleanField, CharField)
+ F, BooleanField, CharField, Count, Func, IntegerField, Sum, Value,
+)
from django.test import TestCase
from django.utils import six
-from .models import Author, Book, Store, DepartmentStore, Company, Employee
+from .models import Author, Book, Company, DepartmentStore, Employee, Store
def cxOracle_513_py3_bug(func):
diff --git a/tests/app_loading/tests.py b/tests/app_loading/tests.py
index 71f1a49b63..d9bead4d61 100644
--- a/tests/app_loading/tests.py
+++ b/tests/app_loading/tests.py
@@ -5,8 +5,8 @@ import os
from django.apps import apps
from django.test import TestCase
from django.test.utils import extend_sys_path
-from django.utils._os import upath
from django.utils import six
+from django.utils._os import upath
class EggLoadingTest(TestCase):
diff --git a/tests/apps/models.py b/tests/apps/models.py
index d6907eced1..733be35d2e 100644
--- a/tests/apps/models.py
+++ b/tests/apps/models.py
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
from django.apps.registry import Apps
from django.db import models
-
# We're testing app registry presence on load, so this is handy.
new_apps = Apps(['apps'])
diff --git a/tests/apps/tests.py b/tests/apps/tests.py
index b7652ed355..5e23ddb9d1 100644
--- a/tests/apps/tests.py
+++ b/tests/apps/tests.py
@@ -2,22 +2,21 @@ from __future__ import unicode_literals
import os
import sys
-from unittest import skipUnless
import warnings
+from unittest import skipUnless
-from django.apps import apps, AppConfig
+from django.apps import AppConfig, apps
from django.apps.registry import Apps
from django.contrib.admin.models import LogEntry
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.test import TestCase, override_settings
from django.test.utils import extend_sys_path
-from django.utils._os import upath
from django.utils import six
+from django.utils._os import upath
from .default_config_app.apps import CustomConfig
-from .models import TotallyNormal, SoAlternative, new_apps
-
+from .models import SoAlternative, TotallyNormal, new_apps
# Small list with a variety of cases for tests that iterate on installed apps.
# Intentionally not in alphabetical order to check if the order is preserved.
diff --git a/tests/backends/models.py b/tests/backends/models.py
index b550212d0b..d69416962d 100644
--- a/tests/backends/models.py
+++ b/tests/backends/models.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 05ffb288d0..a9f8f26618 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -4,26 +4,30 @@ from __future__ import unicode_literals
import copy
import datetime
-from decimal import Decimal, Rounded
import re
import threading
import unittest
import warnings
+from decimal import Decimal, Rounded
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.color import no_style
-from django.db import (connection, connections, DEFAULT_DB_ALIAS,
- DatabaseError, IntegrityError, reset_queries, transaction)
+from django.db import (
+ DEFAULT_DB_ALIAS, DatabaseError, IntegrityError, connection, connections,
+ reset_queries, transaction,
+)
from django.db.backends.base.base import BaseDatabaseWrapper
-from django.db.backends.signals import connection_created
from django.db.backends.postgresql_psycopg2 import version as pg_version
-from django.db.backends.utils import format_number, CursorWrapper
-from django.db.models import Sum, Avg, Variance, StdDev
+from django.db.backends.signals import connection_created
+from django.db.backends.utils import CursorWrapper, format_number
+from django.db.models import Avg, StdDev, Sum, Variance
from django.db.models.sql.constants import CURSOR
from django.db.utils import ConnectionHandler
-from django.test import (TestCase, TransactionTestCase, mock, override_settings,
- skipUnlessDBFeature, skipIfDBFeature)
+from django.test import (
+ TestCase, TransactionTestCase, mock, override_settings, skipIfDBFeature,
+ skipUnlessDBFeature,
+)
from django.test.utils import str_prefix
from django.utils import six
from django.utils.six.moves import range
diff --git a/tests/basic/tests.py b/tests/basic/tests.py
index ad21b2b1c1..d851d858de 100644
--- a/tests/basic/tests.py
+++ b/tests/basic/tests.py
@@ -1,21 +1,22 @@
from __future__ import unicode_literals
-from datetime import datetime, timedelta
import threading
import warnings
+from datetime import datetime, timedelta
-from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
-from django.db import connections, DEFAULT_DB_ALIAS
-from django.db import DatabaseError
+from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
+from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections
from django.db.models.fields import Field
from django.db.models.fields.related import ForeignObjectRel
from django.db.models.manager import BaseManager
-from django.db.models.query import QuerySet, EmptyQuerySet
-from django.test import TestCase, TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature
+from django.db.models.query import EmptyQuerySet, QuerySet
+from django.test import (
+ TestCase, TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature,
+)
from django.utils import six
from django.utils.translation import ugettext_lazy
-from .models import Article, SelfRef, ArticleSelectOnSave
+from .models import Article, ArticleSelectOnSave, SelfRef
class ModelInstanceCreationTests(TestCase):
diff --git a/tests/builtin_server/tests.py b/tests/builtin_server/tests.py
index 2bfdfac66b..e1f3e5d71d 100644
--- a/tests/builtin_server/tests.py
+++ b/tests/builtin_server/tests.py
@@ -1,12 +1,11 @@
from __future__ import unicode_literals
-from io import BytesIO
import sys
import traceback
+from io import BytesIO
from unittest import TestCase
from wsgiref import simple_server
-
# If data is too large, socket will choke, so write chunks no larger than 32MB
# at a time. The rationale behind the 32MB can be found on Django's Trac:
# https://code.djangoproject.com/ticket/5596#comment:4
diff --git a/tests/bulk_create/tests.py b/tests/bulk_create/tests.py
index 742e52fec8..924e69e0a5 100644
--- a/tests/bulk_create/tests.py
+++ b/tests/bulk_create/tests.py
@@ -3,10 +3,11 @@ from __future__ import unicode_literals
from operator import attrgetter
from django.db import connection
-from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
-from django.test import override_settings
+from django.test import (
+ TestCase, override_settings, skipIfDBFeature, skipUnlessDBFeature,
+)
-from .models import Country, Restaurant, Pizzeria, State, TwoFields
+from .models import Country, Pizzeria, Restaurant, State, TwoFields
class BulkCreateTests(TestCase):
diff --git a/tests/cache/models.py b/tests/cache/models.py
index 4fccbb664b..349fd87473 100644
--- a/tests/cache/models.py
+++ b/tests/cache/models.py
@@ -1,6 +1,5 @@
-from django.utils import timezone
-
from django.db import models
+from django.utils import timezone
def expensive_calculation():
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index c17ef12ae0..c6e76c417c 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -4,9 +4,9 @@
# Uses whatever cache backend is set in the test settings file.
from __future__ import unicode_literals
+import copy
import os
import re
-import copy
import shutil
import tempfile
import threading
@@ -15,36 +15,39 @@ import unittest
import warnings
from django.conf import settings
-from django.core import management
-from django.core import signals
-from django.core.cache import cache, caches, CacheKeyWarning, DEFAULT_CACHE_ALIAS
-from django.db import connection, connections, transaction
+from django.core import management, signals
+from django.core.cache import (
+ DEFAULT_CACHE_ALIAS, CacheKeyWarning, cache, caches,
+)
from django.core.cache.utils import make_template_fragment_key
+from django.db import connection, connections, transaction
from django.http import HttpRequest, HttpResponse, StreamingHttpResponse
-from django.middleware.cache import (FetchFromCacheMiddleware,
- UpdateCacheMiddleware, CacheMiddleware)
+from django.middleware.cache import (
+ CacheMiddleware, FetchFromCacheMiddleware, UpdateCacheMiddleware,
+)
from django.middleware.csrf import CsrfViewMiddleware
from django.template import engines
from django.template.context_processors import csrf
from django.template.response import TemplateResponse
-from django.test import (TestCase, TransactionTestCase, RequestFactory,
- override_settings)
+from django.test import (
+ RequestFactory, TestCase, TransactionTestCase, override_settings,
+)
from django.test.signals import setting_changed
-from django.utils import six
-from django.utils import timezone
-from django.utils import translation
-from django.utils.cache import (patch_vary_headers, get_cache_key,
- learn_cache_key, patch_cache_control, patch_response_headers)
+from django.utils import six, timezone, translation
+from django.utils.cache import (
+ get_cache_key, learn_cache_key, patch_cache_control,
+ patch_response_headers, patch_vary_headers,
+)
from django.utils.encoding import force_text
from django.views.decorators.cache import cache_page
+from .models import Poll, expensive_calculation
+
try: # Use the same idiom as in cache backends
from django.utils.six.moves import cPickle as pickle
except ImportError:
import pickle
-from .models import Poll, expensive_calculation
-
# functions/classes for complex data type tests
def f():
diff --git a/tests/check_framework/test_model_field_deprecation.py b/tests/check_framework/test_model_field_deprecation.py
index a8a987b4cb..ce30803a61 100644
--- a/tests/check_framework/test_model_field_deprecation.py
+++ b/tests/check_framework/test_model_field_deprecation.py
@@ -1,5 +1,5 @@
-from django.db import models
from django.core import checks
+from django.db import models
from django.test import SimpleTestCase
from .tests import IsolateModelsMixin
diff --git a/tests/check_framework/test_security.py b/tests/check_framework/test_security.py
index 4a72e60029..c62d96f68c 100644
--- a/tests/check_framework/test_security.py
+++ b/tests/check_framework/test_security.py
@@ -1,11 +1,8 @@
from django.conf import settings
+from django.core.checks.security import base, csrf, sessions
from django.test import TestCase
from django.test.utils import override_settings
-from django.core.checks.security import base
-from django.core.checks.security import csrf
-from django.core.checks.security import sessions
-
class CheckSessionCookieSecureTest(TestCase):
@property
diff --git a/tests/check_framework/tests.py b/tests/check_framework/tests.py
index d15988b117..167d0087ee 100644
--- a/tests/check_framework/tests.py
+++ b/tests/check_framework/tests.py
@@ -1,21 +1,22 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.utils.six import StringIO
import sys
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.core.checks import Error, Warning
+from django.core.checks.compatibility.django_1_7_0 import \
+ check_1_7_compatibility
from django.core.checks.registry import CheckRegistry
-from django.core.checks.compatibility.django_1_7_0 import check_1_7_compatibility
-from django.core.management.base import CommandError
from django.core.management import call_command
+from django.core.management.base import CommandError
from django.db import models
from django.test import TestCase
from django.test.utils import override_settings, override_system_checks
from django.utils.encoding import force_text
+from django.utils.six import StringIO
from .models import SimpleModel
diff --git a/tests/choices/models.py b/tests/choices/models.py
index e33d45733a..3384947f93 100644
--- a/tests/choices/models.py
+++ b/tests/choices/models.py
@@ -12,7 +12,6 @@ field. This method returns the "human-readable" value of the field.
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
-
GENDER_CHOICES = (
('M', 'Male'),
('F', 'Female'),
diff --git a/tests/conditional_processing/tests.py b/tests/conditional_processing/tests.py
index f679996efd..7cbe378be8 100644
--- a/tests/conditional_processing/tests.py
+++ b/tests/conditional_processing/tests.py
@@ -5,7 +5,6 @@ from datetime import datetime
from django.test import TestCase, override_settings
-
FULL_RESPONSE = 'Test conditional get response'
LAST_MODIFIED = datetime(2007, 10, 21, 23, 21, 47)
LAST_MODIFIED_STR = 'Sun, 21 Oct 2007 23:21:47 GMT'
diff --git a/tests/conditional_processing/urls.py b/tests/conditional_processing/urls.py
index 0ae4a6868b..2492a950a4 100644
--- a/tests/conditional_processing/urls.py
+++ b/tests/conditional_processing/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from . import views
-
urlpatterns = [
url('^condition/$', views.index),
url('^condition/last_modified/$', views.last_modified_view1),
diff --git a/tests/conditional_processing/views.py b/tests/conditional_processing/views.py
index 496e79fd34..3542d2bfc1 100644
--- a/tests/conditional_processing/views.py
+++ b/tests/conditional_processing/views.py
@@ -1,7 +1,7 @@
-from django.views.decorators.http import condition, etag, last_modified
from django.http import HttpResponse
+from django.views.decorators.http import condition, etag, last_modified
-from .tests import FULL_RESPONSE, LAST_MODIFIED, ETAG
+from .tests import ETAG, FULL_RESPONSE, LAST_MODIFIED
def index(request):
diff --git a/tests/contenttypes_tests/tests.py b/tests/contenttypes_tests/tests.py
index be727c4a96..a791f8df3c 100644
--- a/tests/contenttypes_tests/tests.py
+++ b/tests/contenttypes_tests/tests.py
@@ -2,10 +2,10 @@
from __future__ import unicode_literals
from django.apps.registry import Apps, apps
+from django.contrib.contenttypes import management
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
-from django.contrib.contenttypes import management
from django.contrib.contenttypes.models import ContentType
from django.core import checks
from django.db import connections, models
@@ -13,7 +13,7 @@ from django.test import TestCase, override_settings
from django.test.utils import captured_stdout
from django.utils.encoding import force_str, force_text
-from .models import Author, Article, SchemeIncludedURL
+from .models import Article, Author, SchemeIncludedURL
@override_settings(ROOT_URLCONF='contenttypes_tests.urls')
diff --git a/tests/context_processors/urls.py b/tests/context_processors/urls.py
index f68720d581..ac887f6613 100644
--- a/tests/context_processors/urls.py
+++ b/tests/context_processors/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from . import views
-
urlpatterns = [
url(r'^request_attrs/$', views.request_processor),
url(r'^debug/$', views.debug_processor),
diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py
index 29d93389f3..21caacc1d9 100644
--- a/tests/csrf_tests/tests.py
+++ b/tests/csrf_tests/tests.py
@@ -1,14 +1,17 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+
import logging
from django.conf import settings
from django.http import HttpRequest, HttpResponse
-from django.middleware.csrf import CsrfViewMiddleware, CSRF_KEY_LENGTH
+from django.middleware.csrf import CSRF_KEY_LENGTH, CsrfViewMiddleware
from django.template import RequestContext, Template
from django.template.context_processors import csrf
from django.test import TestCase, override_settings
-from django.views.decorators.csrf import csrf_exempt, requires_csrf_token, ensure_csrf_cookie
+from django.views.decorators.csrf import (
+ csrf_exempt, ensure_csrf_cookie, requires_csrf_token,
+)
# Response/views used for CsrfResponseMiddleware and CsrfViewMiddleware tests
diff --git a/tests/custom_columns/tests.py b/tests/custom_columns/tests.py
index fab77847b0..b258aea710 100644
--- a/tests/custom_columns/tests.py
+++ b/tests/custom_columns/tests.py
@@ -4,7 +4,7 @@ from django.core.exceptions import FieldError
from django.test import TestCase
from django.utils import six
-from .models import Author, Article
+from .models import Article, Author
class CustomColumnsTests(TestCase):
diff --git a/tests/custom_lookups/tests.py b/tests/custom_lookups/tests.py
index 945c33a0ec..1b45be8451 100644
--- a/tests/custom_lookups/tests.py
+++ b/tests/custom_lookups/tests.py
@@ -1,14 +1,14 @@
from __future__ import unicode_literals
-from datetime import date, datetime
import time
import unittest
+from datetime import date, datetime
from django.core.exceptions import FieldError
-from django.db import models
-from django.db import connection
+from django.db import connection, models
from django.test import TestCase, override_settings
from django.utils import timezone
+
from .models import Author, MySQLUnixTimestamp
diff --git a/tests/custom_managers/models.py b/tests/custom_managers/models.py
index d4ca730629..0444d40f58 100644
--- a/tests/custom_managers/models.py
+++ b/tests/custom_managers/models.py
@@ -11,7 +11,9 @@ returns.
from __future__ import unicode_literals
-from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
+from django.contrib.contenttypes.fields import (
+ GenericForeignKey, GenericRelation,
+)
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
diff --git a/tests/custom_managers/tests.py b/tests/custom_managers/tests.py
index c115482802..7dc5552e41 100644
--- a/tests/custom_managers/tests.py
+++ b/tests/custom_managers/tests.py
@@ -4,9 +4,11 @@ from django.db import models
from django.test import TestCase
from django.utils import six
-from .models import (Book, Car, CustomManager, CustomQuerySet,
- DeconstructibleCustomManager, FunPerson, OneToOneRestrictedModel, Person,
- PersonManager, PublishedBookManager, RelatedModel, RestrictedModel)
+from .models import (
+ Book, Car, CustomManager, CustomQuerySet, DeconstructibleCustomManager,
+ FunPerson, OneToOneRestrictedModel, Person, PersonManager,
+ PublishedBookManager, RelatedModel, RestrictedModel,
+)
class CustomManagerTests(TestCase):
diff --git a/tests/custom_pk/models.py b/tests/custom_pk/models.py
index f4ecc874ee..eb9f86b064 100644
--- a/tests/custom_pk/models.py
+++ b/tests/custom_pk/models.py
@@ -9,9 +9,9 @@ this behavior by explicitly adding ``primary_key=True`` to a field.
from __future__ import unicode_literals
from django.db import models
+from django.utils.encoding import python_2_unicode_compatible
from .fields import MyAutoField
-from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
diff --git a/tests/custom_pk/tests.py b/tests/custom_pk/tests.py
index e3133774e6..9ba506d953 100644
--- a/tests/custom_pk/tests.py
+++ b/tests/custom_pk/tests.py
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import transaction, IntegrityError
+from django.db import IntegrityError, transaction
from django.test import TestCase, skipIfDBFeature
from django.utils import six
-from .models import Employee, Business, Bar, Foo
+from .models import Bar, Business, Employee, Foo
class BasicCustomPKTests(TestCase):
diff --git a/tests/dates/tests.py b/tests/dates/tests.py
index cc6a571d0d..c0f399b091 100644
--- a/tests/dates/tests.py
+++ b/tests/dates/tests.py
@@ -6,7 +6,7 @@ from django.core.exceptions import FieldError
from django.test import TestCase
from django.utils import six
-from .models import Article, Comment, Category
+from .models import Article, Category, Comment
class DatesTests(TestCase):
diff --git a/tests/datetimes/tests.py b/tests/datetimes/tests.py
index 776f6ecc33..447cbef99a 100644
--- a/tests/datetimes/tests.py
+++ b/tests/datetimes/tests.py
@@ -3,16 +3,15 @@ from __future__ import unicode_literals
import datetime
from unittest import skipIf
-try:
- import pytz
-except ImportError:
- pytz = None
-
from django.test import TestCase, override_settings
from django.utils import timezone
+from .models import Article, Category, Comment
-from .models import Article, Comment, Category
+try:
+ import pytz
+except ImportError:
+ pytz = None
class DateTimesTests(TestCase):
diff --git a/tests/db_functions/tests.py b/tests/db_functions/tests.py
index 97d32d86e7..9e7d27899a 100644
--- a/tests/db_functions/tests.py
+++ b/tests/db_functions/tests.py
@@ -1,13 +1,13 @@
from __future__ import unicode_literals
-from django.db.models import TextField, CharField, Value as V
+from django.db.models import CharField, TextField, Value as V
from django.db.models.functions import (
- Coalesce, Concat, Lower, Upper, Length, Substr,
+ Coalesce, Concat, Length, Lower, Substr, Upper,
)
from django.test import TestCase
from django.utils import six, timezone
-from .models import Author, Article
+from .models import Article, Author
lorem_ipsum = """
diff --git a/tests/db_typecasts/tests.py b/tests/db_typecasts/tests.py
index e391743028..d0e0db20d7 100644
--- a/tests/db_typecasts/tests.py
+++ b/tests/db_typecasts/tests.py
@@ -6,7 +6,6 @@ import unittest
from django.db.backends import utils as typecasts
from django.utils import six
-
TEST_CASES = {
'typecast_date': (
('', None),
diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py
index 30423e7c80..d3e2eddf8c 100644
--- a/tests/decorators/tests.py
+++ b/tests/decorators/tests.py
@@ -1,16 +1,24 @@
-from functools import wraps, update_wrapper
+from functools import update_wrapper, wraps
from unittest import TestCase
from django.contrib.admin.views.decorators import staff_member_required
-from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
-from django.http import HttpResponse, HttpRequest, HttpResponseNotAllowed
+from django.contrib.auth.decorators import (
+ login_required, permission_required, user_passes_test,
+)
+from django.http import HttpRequest, HttpResponse, HttpResponseNotAllowed
from django.middleware.clickjacking import XFrameOptionsMiddleware
from django.utils.decorators import method_decorator
from django.utils.functional import allow_lazy, lazy
-from django.views.decorators.cache import cache_page, never_cache, cache_control
-from django.views.decorators.clickjacking import xframe_options_deny, xframe_options_sameorigin, xframe_options_exempt
-from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe, condition
-from django.views.decorators.vary import vary_on_headers, vary_on_cookie
+from django.views.decorators.cache import (
+ cache_control, cache_page, never_cache,
+)
+from django.views.decorators.clickjacking import (
+ xframe_options_deny, xframe_options_exempt, xframe_options_sameorigin,
+)
+from django.views.decorators.http import (
+ condition, require_GET, require_http_methods, require_POST, require_safe,
+)
+from django.views.decorators.vary import vary_on_cookie, vary_on_headers
def fully_decorated(request):
diff --git a/tests/defer/tests.py b/tests/defer/tests.py
index 8471976173..81f00df12b 100644
--- a/tests/defer/tests.py
+++ b/tests/defer/tests.py
@@ -3,7 +3,9 @@ from __future__ import unicode_literals
from django.db.models.query_utils import DeferredAttribute, InvalidQuery
from django.test import TestCase
-from .models import Secondary, Primary, Child, BigChild, ChildProxy, RefreshPrimaryProxy
+from .models import (
+ BigChild, Child, ChildProxy, Primary, RefreshPrimaryProxy, Secondary,
+)
class AssertionMixin(object):
diff --git a/tests/defer_regress/tests.py b/tests/defer_regress/tests.py
index 87638bb99d..6c66a415df 100644
--- a/tests/defer_regress/tests.py
+++ b/tests/defer_regress/tests.py
@@ -6,13 +6,15 @@ from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.backends.db import SessionStore
from django.db.models import Count
-from django.db.models.query_utils import deferred_class_factory, DeferredAttribute
+from django.db.models.query_utils import (
+ DeferredAttribute, deferred_class_factory,
+)
from django.test import TestCase, override_settings
from .models import (
- ResolveThis, Item, RelatedItem, Child, Leaf, Proxy, SimpleItem, Feature,
- ItemAndSimpleItem, OneToOneItem, SpecialFeature, Location, Request,
- ProxyRelated, Derived, Base,
+ Base, Child, Derived, Feature, Item, ItemAndSimpleItem, Leaf, Location,
+ OneToOneItem, Proxy, ProxyRelated, RelatedItem, Request, ResolveThis,
+ SimpleItem, SpecialFeature,
)
diff --git a/tests/delete/tests.py b/tests/delete/tests.py
index c04284e069..24d5aeabea 100644
--- a/tests/delete/tests.py
+++ b/tests/delete/tests.py
@@ -2,14 +2,15 @@ from __future__ import unicode_literals
from math import ceil
-from django.db import models, IntegrityError, connection
+from django.db import IntegrityError, connection, models
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
-from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
+from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from django.utils.six.moves import range
-from .models import (R, RChild, S, T, A, M, MR, MRNull,
- create_a, get_default_r, User, Avatar, HiddenUser, HiddenUserProfile,
- M2MTo, M2MFrom, Parent, Child, Base)
+from .models import (
+ A, M, MR, R, S, T, Avatar, Base, Child, HiddenUser, HiddenUserProfile,
+ M2MFrom, M2MTo, MRNull, Parent, RChild, User, create_a, get_default_r,
+)
class OnDeleteTests(TestCase):
diff --git a/tests/delete_regress/models.py b/tests/delete_regress/models.py
index 6afe84146c..c3ecdac7bf 100644
--- a/tests/delete_regress/models.py
+++ b/tests/delete_regress/models.py
@@ -1,5 +1,5 @@
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
diff --git a/tests/delete_regress/tests.py b/tests/delete_regress/tests.py
index abfa248aea..d03ce3771f 100644
--- a/tests/delete_regress/tests.py
+++ b/tests/delete_regress/tests.py
@@ -3,14 +3,16 @@ from __future__ import unicode_literals
import datetime
from django.conf import settings
-from django.db import transaction, DEFAULT_DB_ALIAS, models
+from django.db import DEFAULT_DB_ALIAS, models, transaction
from django.db.utils import ConnectionHandler
from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature
-from .models import (Book, Award, AwardNote, Person, Child, Toy, PlayedWith,
- PlayedWithNote, Email, Researcher, Food, Eaten, Policy, Version, Location,
- Item, Image, File, Photo, FooFile, FooImage, FooPhoto, FooFileProxy, Login,
- OrgUnit, OrderedPerson, House)
+from .models import (
+ Award, AwardNote, Book, Child, Eaten, Email, File, Food, FooFile,
+ FooFileProxy, FooImage, FooPhoto, House, Image, Item, Location, Login,
+ OrderedPerson, OrgUnit, Person, Photo, PlayedWith, PlayedWithNote, Policy,
+ Researcher, Toy, Version,
+)
# Can't run this test under SQLite, because you can't
diff --git a/tests/dispatch/tests.py b/tests/dispatch/tests.py
index 14aa4a66bd..1860ca0614 100644
--- a/tests/dispatch/tests.py
+++ b/tests/dispatch/tests.py
@@ -7,7 +7,6 @@ from types import TracebackType
from django.dispatch import Signal, receiver
-
if sys.platform.startswith('java'):
def garbage_collect():
# Some JVM GCs will execute finalizers in a different thread, meaning
diff --git a/tests/distinct_on_fields/tests.py b/tests/distinct_on_fields/tests.py
index 3e6e6c2358..68290d7b8f 100644
--- a/tests/distinct_on_fields/tests.py
+++ b/tests/distinct_on_fields/tests.py
@@ -4,7 +4,7 @@ from django.db.models import Max
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import str_prefix
-from .models import Tag, Celebrity, Fan, Staff, StaffTag
+from .models import Celebrity, Fan, Staff, StaffTag, Tag
@skipUnlessDBFeature('can_distinct_on_fields')
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index cce1253e3f..7233fa0d08 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -1,24 +1,28 @@
from __future__ import unicode_literals
-from copy import deepcopy
import datetime
import uuid
+from copy import deepcopy
from django.core.exceptions import FieldError
-from django.db import connection, transaction, DatabaseError
+from django.db import DatabaseError, connection, transaction
from django.db.models import TimeField, UUIDField
-from django.db.models.aggregates import Avg, Count, Max, Min, StdDev, Sum, Variance
+from django.db.models.aggregates import (
+ Avg, Count, Max, Min, StdDev, Sum, Variance,
+)
from django.db.models.expressions import (
- Case, Col, Date, DateTime, F, Func, OrderBy,
- Random, RawSQL, Ref, Value, When
+ F, Case, Col, Date, DateTime, Func, OrderBy, Random, RawSQL, Ref, Value,
+ When,
+)
+from django.db.models.functions import (
+ Coalesce, Concat, Length, Lower, Substr, Upper,
)
-from django.db.models.functions import Coalesce, Concat, Length, Lower, Substr, Upper
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from django.test.utils import Approximate
from django.utils import six
from django.utils.timezone import utc
-from .models import Company, Employee, Number, Experiment, Time, UUID
+from .models import UUID, Company, Employee, Experiment, Number, Time
class BasicExpressionsTests(TestCase):
diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py
index 0790b7b080..79fabeb8db 100644
--- a/tests/expressions_case/tests.py
+++ b/tests/expressions_case/tests.py
@@ -1,25 +1,25 @@
from __future__ import unicode_literals
+import unittest
from datetime import date, datetime, time, timedelta
from decimal import Decimal
from operator import attrgetter, itemgetter
-import unittest
from uuid import UUID
from django.core.exceptions import FieldError
from django.db import connection, models
-from django.db.models import F, Q, Value, Min, Max
+from django.db.models import F, Q, Max, Min, Value
from django.db.models.expressions import Case, When
from django.test import TestCase
from django.utils import six
+from .models import CaseTestModel, Client, FKCaseTestModel, O2OCaseTestModel
+
try:
from PIL import Image
except ImportError:
Image = None
-from .models import CaseTestModel, O2OCaseTestModel, FKCaseTestModel, Client
-
class CaseExpressionTests(TestCase):
@classmethod
diff --git a/tests/extra_regress/tests.py b/tests/extra_regress/tests.py
index 8749cb8ebf..aba6e326e1 100644
--- a/tests/extra_regress/tests.py
+++ b/tests/extra_regress/tests.py
@@ -1,12 +1,12 @@
from __future__ import unicode_literals
-from collections import OrderedDict
import datetime
+from collections import OrderedDict
from django.contrib.auth.models import User
from django.test import TestCase
-from .models import TestObject, Order, RevisionableModel
+from .models import Order, RevisionableModel, TestObject
class ExtraRegressTests(TestCase):
diff --git a/tests/field_subclassing/fields.py b/tests/field_subclassing/fields.py
index b94b2372c1..3bfdb5a89c 100644
--- a/tests/field_subclassing/fields.py
+++ b/tests/field_subclassing/fields.py
@@ -4,11 +4,9 @@ import json
import warnings
from django.db import models
-from django.utils.encoding import force_text
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
-from django.utils.encoding import python_2_unicode_compatible
-
+from django.utils.encoding import force_text, python_2_unicode_compatible
# Catch warning about subfieldbase -- remove in Django 2.0
warnings.filterwarnings(
diff --git a/tests/field_subclassing/models.py b/tests/field_subclassing/models.py
index 66e765ac3e..7ff429c125 100644
--- a/tests/field_subclassing/models.py
+++ b/tests/field_subclassing/models.py
@@ -2,10 +2,9 @@
Tests for field subclassing.
"""
from django.db import models
-from django.utils.encoding import force_text
+from django.utils.encoding import force_text, python_2_unicode_compatible
-from .fields import Small, SmallField, SmallerField, JSONField
-from django.utils.encoding import python_2_unicode_compatible
+from .fields import JSONField, Small, SmallerField, SmallField
@python_2_unicode_compatible
diff --git a/tests/field_subclassing/tests.py b/tests/field_subclassing/tests.py
index 9e40d92496..4d3340260d 100644
--- a/tests/field_subclassing/tests.py
+++ b/tests/field_subclassing/tests.py
@@ -6,7 +6,7 @@ from django.core import exceptions, serializers
from django.db import connection
from django.test import TestCase
-from .fields import Small, CustomTypedField
+from .fields import CustomTypedField, Small
from .models import ChoicesModel, DataModel, MyModel, OtherModel
diff --git a/tests/file_storage/models.py b/tests/file_storage/models.py
index 2f58c53ddd..45a3d9f0e7 100644
--- a/tests/file_storage/models.py
+++ b/tests/file_storage/models.py
@@ -9,8 +9,8 @@ import os
import random
import tempfile
-from django.db import models
from django.core.files.storage import FileSystemStorage
+from django.db import models
class OldStyleFSStorage(FileSystemStorage):
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
index 2718f07cad..2c08a5312f 100644
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -13,20 +13,19 @@ import warnings
from datetime import datetime, timedelta
from django.core.cache import cache
-from django.core.exceptions import SuspiciousOperation, SuspiciousFileOperation
-from django.core.files.base import File, ContentFile
+from django.core.exceptions import SuspiciousFileOperation, SuspiciousOperation
+from django.core.files.base import ContentFile, File
from django.core.files.storage import FileSystemStorage, get_storage_class
-from django.core.files.uploadedfile import (InMemoryUploadedFile, SimpleUploadedFile,
- TemporaryUploadedFile)
-from django.test import LiveServerTestCase, SimpleTestCase
-from django.test import override_settings
+from django.core.files.uploadedfile import (
+ InMemoryUploadedFile, SimpleUploadedFile, TemporaryUploadedFile,
+)
+from django.test import LiveServerTestCase, SimpleTestCase, override_settings
from django.utils import six
-from django.utils.six.moves.urllib.request import urlopen
from django.utils._os import upath
+from django.utils.six.moves.urllib.request import urlopen
from .models import Storage, temp_storage, temp_storage_location
-
FILE_SUFFIX_REGEX = '[A-Za-z0-9]{7}'
diff --git a/tests/file_storage/urls.py b/tests/file_storage/urls.py
index 7d50ef46b8..2bf659f6a8 100644
--- a/tests/file_storage/urls.py
+++ b/tests/file_storage/urls.py
@@ -1,7 +1,6 @@
from django.conf.urls import url
from django.http import HttpResponse
-
urlpatterns = [
url(r'^$', lambda req: HttpResponse('example view')),
]
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py
index 7036c199d0..e9cc9cd8b0 100644
--- a/tests/file_uploads/tests.py
+++ b/tests/file_uploads/tests.py
@@ -13,16 +13,14 @@ import unittest
from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http.multipartparser import MultiPartParser, parse_header
-from django.test import TestCase, client
-from django.test import override_settings
+from django.test import TestCase, client, override_settings
from django.utils.encoding import force_bytes
from django.utils.http import urlquote
-from django.utils.six import BytesIO, PY2, StringIO
+from django.utils.six import PY2, BytesIO, StringIO
from . import uploadhandler
from .models import FileModel
-
UNICODE_FILENAME = 'test-0123456789_中文_Orléans.jpg'
MEDIA_ROOT = sys_tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR'])
UPLOAD_TO = os.path.join(MEDIA_ROOT, 'test_upload')
diff --git a/tests/file_uploads/urls.py b/tests/file_uploads/urls.py
index 99f0cd3eb5..504554483e 100644
--- a/tests/file_uploads/urls.py
+++ b/tests/file_uploads/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from . import views
-
urlpatterns = [
url(r'^upload/$', views.file_upload_view),
url(r'^verify/$', views.file_upload_view_verify),
diff --git a/tests/file_uploads/views.py b/tests/file_uploads/views.py
index 2b00192e2e..5269e98da7 100644
--- a/tests/file_uploads/views.py
+++ b/tests/file_uploads/views.py
@@ -11,7 +11,7 @@ from django.utils.encoding import force_bytes, smart_str
from .models import FileModel
from .tests import UNICODE_FILENAME, UPLOAD_TO
-from .uploadhandler import QuotaUploadHandler, ErroringUploadHandler
+from .uploadhandler import ErroringUploadHandler, QuotaUploadHandler
def file_upload_view(request):
diff --git a/tests/files/tests.py b/tests/files/tests.py
index e16ebd0729..c72d948392 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -1,20 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from io import BytesIO, StringIO
-import os
import gzip
+import os
import tempfile
import unittest
import zlib
+from io import BytesIO, StringIO
from django.core.files import File
-from django.core.files.move import file_move_safe
from django.core.files.base import ContentFile
-from django.core.files.uploadedfile import SimpleUploadedFile, UploadedFile
+from django.core.files.move import file_move_safe
from django.core.files.temp import NamedTemporaryFile
-from django.utils._os import upath
+from django.core.files.uploadedfile import SimpleUploadedFile, UploadedFile
from django.utils import six
+from django.utils._os import upath
try:
from PIL import Image
diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py
index 109d98bec3..e81aea8f6f 100644
--- a/tests/fixtures/tests.py
+++ b/tests/fixtures/tests.py
@@ -6,10 +6,12 @@ import warnings
from django.apps import apps
from django.contrib.sites.models import Site
from django.core import management
-from django.db import connection, IntegrityError
-from django.test import TestCase, TransactionTestCase, ignore_warnings, skipUnlessDBFeature
-from django.utils.encoding import force_text
+from django.db import IntegrityError, connection
+from django.test import (
+ TestCase, TransactionTestCase, ignore_warnings, skipUnlessDBFeature,
+)
from django.utils import six
+from django.utils.encoding import force_text
from .models import Article, Spy, Tag, Visa
diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py
index a91935af8f..63dbe9e72b 100644
--- a/tests/fixtures_regress/tests.py
+++ b/tests/fixtures_regress/tests.py
@@ -7,28 +7,29 @@ import os
import re
import warnings
-from django.core import serializers
+from django.core import management, serializers
from django.core.exceptions import ImproperlyConfigured
-from django.core.serializers.base import DeserializationError
-from django.core import management
from django.core.management.base import CommandError
-from django.db import transaction, IntegrityError
+from django.core.serializers.base import DeserializationError
+from django.db import IntegrityError, transaction
from django.db.models import signals
-from django.test import (TestCase, TransactionTestCase, skipIfDBFeature,
- skipUnlessDBFeature)
-from django.test import override_settings
-from django.utils._os import upath
+from django.test import (
+ TestCase, TransactionTestCase, override_settings, skipIfDBFeature,
+ skipUnlessDBFeature,
+)
from django.utils import six
+from django.utils._os import upath
from django.utils.six import PY3, StringIO
-from .models import (Animal, Stuff, Absolute, Parent, Child, Article, Widget,
- Store, Person, Book, NKChild, RefToNKChild, Circle1, Circle2, Circle3,
- ExternalDependency, Thingy,
- M2MSimpleA, M2MSimpleB, M2MSimpleCircularA, M2MSimpleCircularB,
- M2MComplexA, M2MComplexB, M2MThroughAB, M2MComplexCircular1A,
- M2MComplexCircular1B, M2MComplexCircular1C, M2MCircular1ThroughAB,
- M2MCircular1ThroughBC, M2MCircular1ThroughCA, M2MComplexCircular2A,
- M2MComplexCircular2B, M2MCircular2ThroughAB)
+from .models import (
+ Absolute, Animal, Article, Book, Child, Circle1, Circle2, Circle3,
+ ExternalDependency, M2MCircular1ThroughAB, M2MCircular1ThroughBC,
+ M2MCircular1ThroughCA, M2MCircular2ThroughAB, M2MComplexA, M2MComplexB,
+ M2MComplexCircular1A, M2MComplexCircular1B, M2MComplexCircular1C,
+ M2MComplexCircular2A, M2MComplexCircular2B, M2MSimpleA, M2MSimpleB,
+ M2MSimpleCircularA, M2MSimpleCircularB, M2MThroughAB, NKChild, Parent,
+ Person, RefToNKChild, Store, Stuff, Thingy, Widget,
+)
_cur_dir = os.path.dirname(os.path.abspath(upath(__file__)))
diff --git a/tests/force_insert_update/tests.py b/tests/force_insert_update/tests.py
index 6d87151d83..ae8b771ed1 100644
--- a/tests/force_insert_update/tests.py
+++ b/tests/force_insert_update/tests.py
@@ -1,10 +1,11 @@
from __future__ import unicode_literals
-from django.db import transaction, IntegrityError, DatabaseError
+from django.db import DatabaseError, IntegrityError, transaction
from django.test import TestCase
-from .models import (Counter, WithCustomPK, InheritedCounter, ProxyCounter,
- SubCounter)
+from .models import (
+ Counter, InheritedCounter, ProxyCounter, SubCounter, WithCustomPK,
+)
class ForceTests(TestCase):
diff --git a/tests/foreign_object/models.py b/tests/foreign_object/models.py
index 07d9ff4450..1e3214fec7 100644
--- a/tests/foreign_object/models.py
+++ b/tests/foreign_object/models.py
@@ -1,7 +1,8 @@
import datetime
from django.db import models
-from django.db.models.fields.related import ReverseSingleRelatedObjectDescriptor
+from django.db.models.fields.related import \
+ ReverseSingleRelatedObjectDescriptor
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import get_language
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py
index dc949a3526..5c4c0970f3 100644
--- a/tests/foreign_object/tests.py
+++ b/tests/foreign_object/tests.py
@@ -1,13 +1,16 @@
import datetime
from operator import attrgetter
-from .models import (
- Country, Person, Group, Membership, Friendship, Article,
- ArticleTranslation, ArticleTag, ArticleIdea, NewsArticle)
+from django import forms
+from django.core.exceptions import FieldError
from django.test import TestCase, skipUnlessDBFeature
from django.utils import translation
-from django.core.exceptions import FieldError
-from django import forms
+
+from .models import (
+ Article, ArticleIdea, ArticleTag, ArticleTranslation, Country, Friendship,
+ Group, Membership, NewsArticle, Person,
+)
+
# Note that these tests are testing internal implementation details.
# ForeignObject is not part of public API.
diff --git a/tests/forms_tests/models.py b/tests/forms_tests/models.py
index 82fa005025..936bf8b41f 100644
--- a/tests/forms_tests/models.py
+++ b/tests/forms_tests/models.py
@@ -10,7 +10,6 @@ from django.core.files.storage import FileSystemStorage
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
-
callable_default_counter = itertools.count()
callable_default = lambda: next(callable_default_counter)
diff --git a/tests/forms_tests/tests/test_error_messages.py b/tests/forms_tests/tests/test_error_messages.py
index 5f79d4aa95..c02a44f8ff 100644
--- a/tests/forms_tests/tests/test_error_messages.py
+++ b/tests/forms_tests/tests/test_error_messages.py
@@ -7,11 +7,11 @@ from django.forms import (
DecimalField, EmailField, FileField, FloatField, Form,
GenericIPAddressField, IntegerField, ModelChoiceField,
ModelMultipleChoiceField, MultipleChoiceField, RegexField,
- SplitDateTimeField, TimeField, URLField, utils, ValidationError,
+ SplitDateTimeField, TimeField, URLField, ValidationError, utils,
)
from django.test import TestCase
-from django.utils.safestring import mark_safe
from django.utils.encoding import python_2_unicode_compatible
+from django.utils.safestring import mark_safe
class AssertFormErrorsMixin(object):
diff --git a/tests/forms_tests/tests/test_fields.py b/tests/forms_tests/tests/test_fields.py
index fda451281f..ed060bc064 100644
--- a/tests/forms_tests/tests/test_fields.py
+++ b/tests/forms_tests/tests/test_fields.py
@@ -27,34 +27,32 @@ __init__(). For example, CharField has a max_length option.
from __future__ import unicode_literals
import datetime
+import os
import pickle
import re
-import os
import uuid
from decimal import Decimal
from unittest import skipIf
-try:
- from PIL import Image
-except ImportError:
- Image = None
-
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import (
BooleanField, CharField, ChoiceField, ComboField, DateField, DateTimeField,
DecimalField, DurationField, EmailField, Field, FileField, FilePathField,
- FloatField, Form, forms, GenericIPAddressField, HiddenInput, ImageField,
+ FloatField, Form, GenericIPAddressField, HiddenInput, ImageField,
IntegerField, MultipleChoiceField, NullBooleanField, NumberInput,
PasswordInput, RadioSelect, RegexField, SlugField, SplitDateTimeField,
- TextInput, Textarea, TimeField, TypedChoiceField, TypedMultipleChoiceField,
- URLField, UUIDField, ValidationError, Widget,
+ Textarea, TextInput, TimeField, TypedChoiceField, TypedMultipleChoiceField,
+ URLField, UUIDField, ValidationError, Widget, forms,
)
from django.test import SimpleTestCase, ignore_warnings
-from django.utils import formats
-from django.utils import six
-from django.utils import translation
-from django.utils.deprecation import RemovedInDjango20Warning
+from django.utils import formats, six, translation
from django.utils._os import upath
+from django.utils.deprecation import RemovedInDjango20Warning
+
+try:
+ from PIL import Image
+except ImportError:
+ Image = None
def fix_os_paths(x):
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index df090ef60e..4024f0359e 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -10,22 +10,22 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import RegexValidator
from django.forms import (
BooleanField, CharField, CheckboxSelectMultiple, ChoiceField, DateField,
- DateTimeField, EmailField, FileField, FloatField, Form, forms, HiddenInput,
+ DateTimeField, EmailField, FileField, FloatField, Form, HiddenInput,
ImageField, IntegerField, MultipleChoiceField, MultipleHiddenInput,
MultiValueField, NullBooleanField, PasswordInput, RadioSelect, Select,
SplitDateTimeField, SplitHiddenDateTimeWidget, Textarea, TextInput,
- TimeField, ValidationError,
+ TimeField, ValidationError, forms,
)
from django.forms.utils import ErrorList
from django.http import QueryDict
-from django.template import Template, Context
+from django.template import Context, Template
from django.test import TestCase
from django.test.utils import str_prefix
+from django.utils import six
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import format_html
-from django.utils.safestring import mark_safe, SafeData
-from django.utils import six
+from django.utils.safestring import SafeData, mark_safe
class Person(Form):
diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py
index 276bf1cb22..7f450247eb 100644
--- a/tests/forms_tests/tests/test_formsets.py
+++ b/tests/forms_tests/tests/test_formsets.py
@@ -3,8 +3,10 @@ from __future__ import unicode_literals
import datetime
-from django.forms import (CharField, DateField, FileField, Form, IntegerField,
- SplitDateTimeField, ValidationError, formsets)
+from django.forms import (
+ CharField, DateField, FileField, Form, IntegerField, SplitDateTimeField,
+ ValidationError, formsets,
+)
from django.forms.formsets import BaseFormSet, formset_factory
from django.forms.utils import ErrorList
from django.test import TestCase
diff --git a/tests/forms_tests/tests/test_input_formats.py b/tests/forms_tests/tests/test_input_formats.py
index 60e153db4c..afb2513a95 100644
--- a/tests/forms_tests/tests/test_input_formats.py
+++ b/tests/forms_tests/tests/test_input_formats.py
@@ -1,9 +1,8 @@
-from datetime import time, date, datetime
+from datetime import date, datetime, time
from django import forms
-from django.test import override_settings
+from django.test import SimpleTestCase, override_settings
from django.utils.translation import activate, deactivate
-from django.test import SimpleTestCase
@override_settings(TIME_INPUT_FORMATS=["%I:%M:%S %p", "%I:%M %p"], USE_L10N=True)
diff --git a/tests/forms_tests/tests/test_media.py b/tests/forms_tests/tests/test_media.py
index c44e443eac..027e410f30 100644
--- a/tests/forms_tests/tests/test_media.py
+++ b/tests/forms_tests/tests/test_media.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from django.forms import Media, TextInput, CharField, Form, MultiWidget
-from django.template import Template, Context
+from django.forms import CharField, Form, Media, MultiWidget, TextInput
+from django.template import Context, Template
from django.test import TestCase, override_settings
diff --git a/tests/forms_tests/tests/test_regressions.py b/tests/forms_tests/tests/test_regressions.py
index b0b360e679..3a20d4d9fb 100644
--- a/tests/forms_tests/tests/test_regressions.py
+++ b/tests/forms_tests/tests/test_regressions.py
@@ -10,7 +10,7 @@ from django.test import TestCase, ignore_warnings
from django.utils import translation
from django.utils.translation import gettext_lazy, ugettext_lazy
-from forms_tests.models import Cheese
+from ..models import Cheese
class FormsRegressionsTestCase(TestCase):
diff --git a/tests/forms_tests/tests/test_utils.py b/tests/forms_tests/tests/test_utils.py
index 9f412b7a27..4519963d96 100644
--- a/tests/forms_tests/tests/test_utils.py
+++ b/tests/forms_tests/tests/test_utils.py
@@ -4,12 +4,12 @@ from __future__ import unicode_literals
import copy
from django.core.exceptions import ValidationError
-from django.forms.utils import flatatt, ErrorDict, ErrorList
+from django.forms.utils import ErrorDict, ErrorList, flatatt
from django.test import TestCase
-from django.utils.safestring import mark_safe
from django.utils import six
-from django.utils.translation import ugettext_lazy
from django.utils.encoding import python_2_unicode_compatible
+from django.utils.safestring import mark_safe
+from django.utils.translation import ugettext_lazy
class FormsUtilsTestCase(TestCase):
diff --git a/tests/forms_tests/tests/test_widgets.py b/tests/forms_tests/tests/test_widgets.py
index b58c4e74e4..fc8ac93721 100644
--- a/tests/forms_tests/tests/test_widgets.py
+++ b/tests/forms_tests/tests/test_widgets.py
@@ -16,11 +16,11 @@ from django.forms import (
SplitDateTimeWidget, Textarea, TextInput, TimeInput, ValidationError,
)
from django.forms.widgets import RadioFieldRenderer
-from django.utils.safestring import mark_safe, SafeData
-from django.utils import six, translation
from django.test import TestCase, override_settings
+from django.utils import six, translation
from django.utils.dates import MONTHS_AP
from django.utils.encoding import force_text, python_2_unicode_compatible
+from django.utils.safestring import SafeData, mark_safe
from ..models import Article
diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py
index 0b3d5765a0..8e8aa82cdd 100644
--- a/tests/forms_tests/tests/tests.py
+++ b/tests/forms_tests/tests/tests.py
@@ -5,13 +5,17 @@ import datetime
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import models
-from django.forms import Form, ModelForm, FileField, ModelChoiceField, CharField
+from django.forms import (
+ CharField, FileField, Form, ModelChoiceField, ModelForm,
+)
from django.forms.models import ModelFormMetaclass
from django.test import TestCase
from django.utils import six
-from ..models import (ChoiceModel, ChoiceOptionModel, ChoiceFieldModel,
- FileModel, Group, BoundaryModel, Defaults, OptionalMultiChoiceModel)
+from ..models import (
+ BoundaryModel, ChoiceFieldModel, ChoiceModel, ChoiceOptionModel, Defaults,
+ FileModel, Group, OptionalMultiChoiceModel,
+)
class ChoiceFieldForm(ModelForm):
diff --git a/tests/forms_tests/urls.py b/tests/forms_tests/urls.py
index e4a91469b1..ab7fa902a9 100644
--- a/tests/forms_tests/urls.py
+++ b/tests/forms_tests/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from .views import ArticleFormView
-
urlpatterns = [
url(r'^model_form/(?P<pk>[0-9]+)/$', ArticleFormView.as_view(), name="article_form"),
]
diff --git a/tests/from_db_value/tests.py b/tests/from_db_value/tests.py
index 69e22d4290..10b9e1556e 100644
--- a/tests/from_db_value/tests.py
+++ b/tests/from_db_value/tests.py
@@ -2,7 +2,7 @@ from django.db import connection
from django.db.models import Max
from django.test import TestCase
-from .models import CashModel, Cash
+from .models import Cash, CashModel
class FromDBValueTest(TestCase):
diff --git a/tests/generic_inline_admin/admin.py b/tests/generic_inline_admin/admin.py
index 46f6cf3e7f..3f13b394f3 100644
--- a/tests/generic_inline_admin/admin.py
+++ b/tests/generic_inline_admin/admin.py
@@ -1,9 +1,9 @@
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
-from .models import (Media, PhoneNumber, Episode, Contact,
- Category, EpisodePermanent)
-
+from .models import (
+ Category, Contact, Episode, EpisodePermanent, Media, PhoneNumber,
+)
site = admin.AdminSite(name="admin")
diff --git a/tests/generic_inline_admin/models.py b/tests/generic_inline_admin/models.py
index 059aadc5ba..d15f2b9f17 100644
--- a/tests/generic_inline_admin/models.py
+++ b/tests/generic_inline_admin/models.py
@@ -1,5 +1,5 @@
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py
index 325d94c7a7..0394377466 100644
--- a/tests/generic_inline_admin/tests.py
+++ b/tests/generic_inline_admin/tests.py
@@ -10,9 +10,8 @@ from django.forms.formsets import DEFAULT_MAX_NUM
from django.forms.models import ModelForm
from django.test import RequestFactory, TestCase, override_settings
-# local test models
from .admin import MediaInline, MediaPermanentInline, site as admin_site
-from .models import Episode, Media, EpisodePermanent, Category
+from .models import Category, Episode, EpisodePermanent, Media
# Set TEMPLATE_DEBUG to True to ensure {% include %} will raise exceptions.
diff --git a/tests/generic_relations/models.py b/tests/generic_relations/models.py
index cd013e580a..1f1872dd0f 100644
--- a/tests/generic_relations/models.py
+++ b/tests/generic_relations/models.py
@@ -12,7 +12,7 @@ from complete).
from __future__ import unicode_literals
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
diff --git a/tests/generic_relations/tests.py b/tests/generic_relations/tests.py
index bc2cfaa579..05ce20f078 100644
--- a/tests/generic_relations/tests.py
+++ b/tests/generic_relations/tests.py
@@ -8,10 +8,11 @@ from django.db.models import Q
from django.test import TestCase
from django.utils import six
-from .models import (TaggedItem, ValuableTaggedItem, Comparison, Animal,
- Vegetable, Mineral, Gecko, Rock, ManualPK,
- ForProxyModelModel, ForConcreteModelModel,
- ProxyRelatedModel, ConcreteRelatedModel, AllowsNullGFK)
+from .models import (
+ AllowsNullGFK, Animal, Comparison, ConcreteRelatedModel,
+ ForConcreteModelModel, ForProxyModelModel, Gecko, ManualPK, Mineral,
+ ProxyRelatedModel, Rock, TaggedItem, ValuableTaggedItem, Vegetable,
+)
class GenericRelationsTests(TestCase):
diff --git a/tests/generic_relations_regress/models.py b/tests/generic_relations_regress/models.py
index b57b887e4a..ffedbc86f8 100644
--- a/tests/generic_relations_regress/models.py
+++ b/tests/generic_relations_regress/models.py
@@ -1,11 +1,10 @@
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
-from django.utils.encoding import python_2_unicode_compatible
from django.db.models.deletion import ProtectedError
-
+from django.utils.encoding import python_2_unicode_compatible
__all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address',
'CharLink', 'TextLink', 'OddRelation1', 'OddRelation2',
diff --git a/tests/generic_relations_regress/tests.py b/tests/generic_relations_regress/tests.py
index 88243bade0..0d78223725 100644
--- a/tests/generic_relations_regress/tests.py
+++ b/tests/generic_relations_regress/tests.py
@@ -1,14 +1,13 @@
from django.db.models import Q, Sum
+from django.db.models.deletion import ProtectedError
from django.db.utils import IntegrityError
-from django.test import TestCase, skipIfDBFeature
from django.forms.models import modelform_factory
-from django.db.models.deletion import ProtectedError
+from django.test import TestCase, skipIfDBFeature
from .models import (
- Address, Place, Restaurant, Link, CharLink, TextLink,
- Person, Contact, Note, Organization, OddRelation1, OddRelation2, Company,
- Developer, Team, Guild, Tag, Board, HasLinkThing, A, B, C, D,
- Related, Content, Node,
+ A, B, C, D, Address, Board, CharLink, Company, Contact, Content, Developer,
+ Guild, HasLinkThing, Link, Node, Note, OddRelation1, OddRelation2,
+ Organization, Person, Place, Related, Restaurant, Tag, Team, TextLink,
)
diff --git a/tests/generic_views/test_base.py b/tests/generic_views/test_base.py
index f297b2e91b..bf7fa0fc34 100644
--- a/tests/generic_views/test_base.py
+++ b/tests/generic_views/test_base.py
@@ -6,9 +6,9 @@ import unittest
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import resolve
from django.http import HttpResponse
-from django.test import TestCase, RequestFactory, override_settings
+from django.test import RequestFactory, TestCase, override_settings
from django.test.utils import require_jinja2
-from django.views.generic import View, TemplateView, RedirectView
+from django.views.generic import RedirectView, TemplateView, View
from . import views
diff --git a/tests/generic_views/test_edit.py b/tests/generic_views/test_edit.py
index b61a11086a..91d0d20ff7 100644
--- a/tests/generic_views/test_edit.py
+++ b/tests/generic_views/test_edit.py
@@ -2,14 +2,14 @@ from __future__ import unicode_literals
import warnings
+from django import forms
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
-from django import forms
from django.test import TestCase, ignore_warnings, override_settings
from django.test.client import RequestFactory
from django.utils.deprecation import RemovedInDjango20Warning
from django.views.generic.base import View
-from django.views.generic.edit import FormMixin, ModelFormMixin, CreateView
+from django.views.generic.edit import CreateView, FormMixin, ModelFormMixin
from . import views
from .models import Artist, Author
diff --git a/tests/generic_views/test_list.py b/tests/generic_views/test_list.py
index f5b91c74bb..b9274242c9 100644
--- a/tests/generic_views/test_list.py
+++ b/tests/generic_views/test_list.py
@@ -4,10 +4,10 @@ import datetime
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings
-from django.views.generic.base import View
from django.utils.encoding import force_str
+from django.views.generic.base import View
-from .models import Author, Artist, Book
+from .models import Artist, Author, Book
@override_settings(ROOT_URLCONF='generic_views.urls')
diff --git a/tests/generic_views/urls.py b/tests/generic_views/urls.py
index e09ee12562..83ba68fa2e 100644
--- a/tests/generic_views/urls.py
+++ b/tests/generic_views/urls.py
@@ -7,9 +7,7 @@ from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
-from . import models
-from . import views
-
+from . import models, views
urlpatterns = [
# TemplateView
diff --git a/tests/generic_views/views.py b/tests/generic_views/views.py
index fe7fb88876..6dcac21aa6 100644
--- a/tests/generic_views/views.py
+++ b/tests/generic_views/views.py
@@ -6,8 +6,8 @@ from django.core.urlresolvers import reverse, reverse_lazy
from django.utils.decorators import method_decorator
from django.views import generic
+from .models import Artist, Author, Book, BookSigning, Page
from .test_forms import AuthorForm, ContactForm
-from .models import Artist, Author, Book, Page, BookSigning
class CustomTemplateView(generic.TemplateView):
diff --git a/tests/get_earliest_or_latest/tests.py b/tests/get_earliest_or_latest/tests.py
index de3307b1a6..c4e4bb7586 100644
--- a/tests/get_earliest_or_latest/tests.py
+++ b/tests/get_earliest_or_latest/tests.py
@@ -4,7 +4,7 @@ from datetime import datetime
from django.test import TestCase
-from .models import Article, Person, IndexErrorArticle
+from .models import Article, IndexErrorArticle, Person
class EarliestOrLatestTests(TestCase):
diff --git a/tests/get_object_or_404/tests.py b/tests/get_object_or_404/tests.py
index 75d2a1c784..a5e3d2d8b8 100644
--- a/tests/get_object_or_404/tests.py
+++ b/tests/get_object_or_404/tests.py
@@ -1,10 +1,10 @@
from __future__ import unicode_literals
from django.http import Http404
-from django.shortcuts import get_object_or_404, get_list_or_404
+from django.shortcuts import get_list_or_404, get_object_or_404
from django.test import TestCase
-from .models import Author, Article
+from .models import Article, Author
class GetObjectOr404Tests(TestCase):
diff --git a/tests/get_or_create/tests.py b/tests/get_or_create/tests.py
index f15d84323d..a58e77ec0e 100644
--- a/tests/get_or_create/tests.py
+++ b/tests/get_or_create/tests.py
@@ -1,14 +1,16 @@
from __future__ import unicode_literals
-from datetime import date
import traceback
+from datetime import date
-from django.db import IntegrityError, DatabaseError
-from django.utils.encoding import DjangoUnicodeDecodeError
+from django.db import DatabaseError, IntegrityError
from django.test import TestCase, TransactionTestCase, ignore_warnings
+from django.utils.encoding import DjangoUnicodeDecodeError
-from .models import (DefaultPerson, Person, ManualPrimaryKeyTest, Profile,
- Tag, Thing, Publisher, Author, Book)
+from .models import (
+ Author, Book, DefaultPerson, ManualPrimaryKeyTest, Person, Profile,
+ Publisher, Tag, Thing,
+)
class GetOrCreateTests(TestCase):
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py
index a543513a25..a1fed74105 100644
--- a/tests/handlers/tests.py
+++ b/tests/handlers/tests.py
@@ -3,12 +3,13 @@
from __future__ import unicode_literals
from django.core.handlers.wsgi import WSGIHandler, WSGIRequest
-from django.core.signals import request_started, request_finished
+from django.core.signals import request_finished, request_started
from django.db import close_old_connections, connection
-from django.test import RequestFactory, TestCase, TransactionTestCase
-from django.test import override_settings
-from django.utils.encoding import force_str
+from django.test import (
+ RequestFactory, TestCase, TransactionTestCase, override_settings,
+)
from django.utils import six
+from django.utils.encoding import force_str
class HandlerTests(TestCase):
diff --git a/tests/http_utils/tests.py b/tests/http_utils/tests.py
index d88afb951c..2a2b29bbfb 100644
--- a/tests/http_utils/tests.py
+++ b/tests/http_utils/tests.py
@@ -1,9 +1,11 @@
from __future__ import unicode_literals
-import io
import gzip
+import io
-from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, StreamingHttpResponse
+from django.http import (
+ HttpRequest, HttpResponse, HttpResponseRedirect, StreamingHttpResponse,
+)
from django.http.utils import conditional_content_removal, fix_location_header
from django.test import TestCase
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
index 14ad306c65..bea1c50b7e 100644
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -11,16 +11,17 @@ from django.core.exceptions import SuspiciousOperation
from django.core.serializers.json import DjangoJSONEncoder
from django.core.signals import request_finished
from django.db import close_old_connections
-from django.http import (QueryDict, HttpResponse, HttpResponseRedirect,
- HttpResponsePermanentRedirect, HttpResponseNotAllowed,
- HttpResponseNotModified, StreamingHttpResponse,
- SimpleCookie, BadHeaderError, JsonResponse,
- parse_cookie)
+from django.http import (
+ BadHeaderError, HttpResponse, HttpResponseNotAllowed,
+ HttpResponseNotModified, HttpResponsePermanentRedirect,
+ HttpResponseRedirect, JsonResponse, QueryDict, SimpleCookie,
+ StreamingHttpResponse, parse_cookie,
+)
from django.test import TestCase
-from django.utils.encoding import smart_str, force_text
-from django.utils.functional import lazy
-from django.utils._os import upath
from django.utils import six
+from django.utils._os import upath
+from django.utils.encoding import force_text, smart_str
+from django.utils.functional import lazy
lazystr = lazy(force_text, six.text_type)
diff --git a/tests/i18n/contenttypes/tests.py b/tests/i18n/contenttypes/tests.py
index a93f2030f2..890fa1156b 100644
--- a/tests/i18n/contenttypes/tests.py
+++ b/tests/i18n/contenttypes/tests.py
@@ -5,9 +5,8 @@ import os
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase, override_settings
+from django.utils import six, translation
from django.utils._os import upath
-from django.utils import six
-from django.utils import translation
@override_settings(
diff --git a/tests/i18n/patterns/tests.py b/tests/i18n/patterns/tests.py
index f96ac82fc4..1ac0e8a4a9 100644
--- a/tests/i18n/patterns/tests.py
+++ b/tests/i18n/patterns/tests.py
@@ -3,13 +3,15 @@ from __future__ import unicode_literals
import os
from django.core.exceptions import ImproperlyConfigured
-from django.core.urlresolvers import reverse, clear_url_caches, set_script_prefix
+from django.core.urlresolvers import (
+ clear_url_caches, reverse, set_script_prefix,
+)
from django.http import HttpResponsePermanentRedirect
from django.middleware.locale import LocaleMiddleware
+from django.template import Context, Template
from django.test import TestCase, override_settings
-from django.template import Template, Context
-from django.utils._os import upath
from django.utils import translation
+from django.utils._os import upath
class PermanentRedirectLocaleMiddleWare(LocaleMiddleware):
diff --git a/tests/i18n/patterns/urls/default.py b/tests/i18n/patterns/urls/default.py
index 416c4e854f..caf1a7637d 100644
--- a/tests/i18n/patterns/urls/default.py
+++ b/tests/i18n/patterns/urls/default.py
@@ -3,7 +3,6 @@ from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
-
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = [
diff --git a/tests/i18n/patterns/urls/included.py b/tests/i18n/patterns/urls/included.py
index eb4631c087..ded29a8bf1 100644
--- a/tests/i18n/patterns/urls/included.py
+++ b/tests/i18n/patterns/urls/included.py
@@ -1,7 +1,6 @@
from django.conf.urls import url
from django.views.generic import TemplateView
-
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = [
diff --git a/tests/i18n/patterns/urls/namespace.py b/tests/i18n/patterns/urls/namespace.py
index 570a7572e6..6060c57bd6 100644
--- a/tests/i18n/patterns/urls/namespace.py
+++ b/tests/i18n/patterns/urls/namespace.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
-
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = [
diff --git a/tests/i18n/patterns/urls/path_unused.py b/tests/i18n/patterns/urls/path_unused.py
index cd17527bf0..e2186d3d02 100644
--- a/tests/i18n/patterns/urls/path_unused.py
+++ b/tests/i18n/patterns/urls/path_unused.py
@@ -1,7 +1,6 @@
from django.conf.urls import url
from django.views.generic import TemplateView
-
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = [
diff --git a/tests/i18n/patterns/urls/wrong.py b/tests/i18n/patterns/urls/wrong.py
index fe948e0563..a8f9410db8 100644
--- a/tests/i18n/patterns/urls/wrong.py
+++ b/tests/i18n/patterns/urls/wrong.py
@@ -2,7 +2,6 @@ from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import ugettext_lazy as _
-
urlpatterns = i18n_patterns(
url(_(r'^account/'), include('i18n.patterns.urls.wrong_namespace', namespace='account')),
)
diff --git a/tests/i18n/patterns/urls/wrong_namespace.py b/tests/i18n/patterns/urls/wrong_namespace.py
index f3b55b69fe..e19c99c935 100644
--- a/tests/i18n/patterns/urls/wrong_namespace.py
+++ b/tests/i18n/patterns/urls/wrong_namespace.py
@@ -3,7 +3,6 @@ from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
-
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = i18n_patterns(
diff --git a/tests/i18n/test_compilation.py b/tests/i18n/test_compilation.py
index c17db0a98a..682885bec8 100644
--- a/tests/i18n/test_compilation.py
+++ b/tests/i18n/test_compilation.py
@@ -1,21 +1,22 @@
# -*- coding: utf-8 -*-
+import gettext as gettext_module
import os
import shutil
import stat
import unittest
-import gettext as gettext_module
-from django.core.management import call_command, CommandError, execute_from_command_line
+from django.core.management import (
+ CommandError, call_command, execute_from_command_line,
+)
from django.core.management.utils import find_command
-from django.test import SimpleTestCase
-from django.test import override_settings
+from django.test import SimpleTestCase, override_settings
from django.test.utils import captured_stderr, captured_stdout
from django.utils import translation
-from django.utils.translation import ugettext
-from django.utils.encoding import force_text
from django.utils._os import upath
+from django.utils.encoding import force_text
from django.utils.six import StringIO
+from django.utils.translation import ugettext
has_msgfmt = find_command('msgfmt')
diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py
index 99d4983b43..556cba7fa4 100644
--- a/tests/i18n/test_extraction.py
+++ b/tests/i18n/test_extraction.py
@@ -6,24 +6,24 @@ import os
import re
import shutil
import time
-from unittest import SkipTest, skipUnless
import warnings
+from unittest import SkipTest, skipUnless
from django.conf import settings
from django.core import management
from django.core.management import execute_from_command_line
from django.core.management.base import CommandError
-from django.core.management.commands.makemessages import Command as MakeMessagesCommand
+from django.core.management.commands.makemessages import \
+ Command as MakeMessagesCommand
from django.core.management.utils import find_command
-from django.test import mock, override_settings, SimpleTestCase
+from django.test import SimpleTestCase, mock, override_settings
from django.test.utils import captured_stderr, captured_stdout
-from django.utils.encoding import force_text
-from django.utils._os import upath
from django.utils import six
+from django.utils._os import upath
+from django.utils.encoding import force_text
from django.utils.six import StringIO
from django.utils.translation import TranslatorCommentWarning
-
LOCALE = 'de'
has_xgettext = find_command('xgettext')
this_directory = os.path.dirname(upath(__file__))
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index cbc31828b4..b9a2858148 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -1,45 +1,40 @@
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
-from contextlib import contextmanager
import datetime
import decimal
import gettext as gettext_module
-from importlib import import_module
import os
import pickle
+from contextlib import contextmanager
+from importlib import import_module
from threading import local
from unittest import skipUnless
from django import forms
from django.conf import settings
-from django.template import Template, Context
+from django.template import Context, Template
from django.template.base import TemplateSyntaxError
-from django.test import TestCase, RequestFactory, override_settings
-from django.utils import translation
-from django.utils.formats import (get_format, date_format, time_format,
- localize, localize_input, iter_format_modules, get_format_modules,
- reset_format_cache, sanitize_separators)
-from django.utils.numberformat import format as nformat
+from django.test import RequestFactory, TestCase, override_settings
+from django.utils import six, translation
from django.utils._os import upath
-from django.utils.safestring import mark_safe, SafeBytes, SafeString, SafeText
-from django.utils import six
+from django.utils.formats import (
+ date_format, get_format, get_format_modules, iter_format_modules, localize,
+ localize_input, reset_format_cache, sanitize_separators, time_format,
+)
+from django.utils.numberformat import format as nformat
+from django.utils.safestring import SafeBytes, SafeString, SafeText, mark_safe
from django.utils.six import PY3
-from django.utils.translation import (activate, deactivate,
- get_language, get_language_from_request, get_language_info,
- to_locale, trans_real,
- gettext, gettext_lazy,
- ugettext, ugettext_lazy,
- ngettext_lazy,
- ungettext_lazy,
- pgettext, pgettext_lazy,
- npgettext, npgettext_lazy,
- check_for_language,
- string_concat, LANGUAGE_SESSION_KEY)
-
-from .forms import I18nForm, SelectDateForm, CompanyForm
-from .models import Company, TestModel
+from django.utils.translation import (
+ LANGUAGE_SESSION_KEY, activate, check_for_language, deactivate,
+ get_language, get_language_from_request, get_language_info, gettext,
+ gettext_lazy, ngettext_lazy, npgettext, npgettext_lazy, pgettext,
+ pgettext_lazy, string_concat, to_locale, trans_real, ugettext,
+ ugettext_lazy, ungettext_lazy,
+)
+from .forms import CompanyForm, I18nForm, SelectDateForm
+from .models import Company, TestModel
here = os.path.dirname(os.path.abspath(upath(__file__)))
extended_locale_paths = settings.LOCALE_PATHS + [
diff --git a/tests/i18n/urls.py b/tests/i18n/urls.py
index c1124a1b8c..d63499f1bb 100644
--- a/tests/i18n/urls.py
+++ b/tests/i18n/urls.py
@@ -6,7 +6,6 @@ from django.test import ignore_warnings
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.translation import ugettext_lazy as _
-
# test deprecated version of i18n_patterns() function (with prefix). Remove it
# and convert to list of urls() in Django 2.0
i18n_patterns = ignore_warnings(category=RemovedInDjango20Warning)(i18n_patterns)
diff --git a/tests/indexes/models.py b/tests/indexes/models.py
index c3d43913dd..3e9cbf630b 100644
--- a/tests/indexes/models.py
+++ b/tests/indexes/models.py
@@ -1,5 +1,4 @@
-from django.db import connection
-from django.db import models
+from django.db import connection, models
class CurrentTranslation(models.ForeignObject):
diff --git a/tests/inline_formsets/tests.py b/tests/inline_formsets/tests.py
index 6f6bc76ac8..167d2a68e1 100644
--- a/tests/inline_formsets/tests.py
+++ b/tests/inline_formsets/tests.py
@@ -4,7 +4,7 @@ from django.forms.models import inlineformset_factory
from django.test import TestCase, skipUnlessDBFeature
from django.utils import six
-from .models import Poet, Poem, School, Parent, Child
+from .models import Child, Parent, Poem, Poet, School
class DeletionTests(TestCase):
diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py
index cc6b33e572..1280c13fe0 100644
--- a/tests/introspection/tests.py
+++ b/tests/introspection/tests.py
@@ -6,7 +6,7 @@ from django.db import connection
from django.db.utils import DatabaseError
from django.test import TransactionTestCase, mock, skipUnlessDBFeature
-from .models import Reporter, Article
+from .models import Article, Reporter
class IntrospectionTests(TransactionTestCase):
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 3c874ad11b..85599bc68a 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -5,7 +5,7 @@ import unittest
from django.conf import settings
from django.core.checks import Error
-from django.db import models, connections
+from django.db import connections, models
from django.test.utils import override_settings
from .base import IsolatedModelsTestCase
diff --git a/tests/invalid_models_tests/test_relative_fields.py b/tests/invalid_models_tests/test_relative_fields.py
index 9781ecc2ba..b6ac3de722 100644
--- a/tests/invalid_models_tests/test_relative_fields.py
+++ b/tests/invalid_models_tests/test_relative_fields.py
@@ -3,8 +3,8 @@ from __future__ import unicode_literals
from django.core.checks import Error, Warning as DjangoWarning
from django.db import models
-from django.test.utils import override_settings
from django.test.testcases import skipIfDBFeature
+from django.test.utils import override_settings
from .base import IsolatedModelsTestCase
diff --git a/tests/known_related_objects/tests.py b/tests/known_related_objects/tests.py
index f7ac18c981..9712ee69ca 100644
--- a/tests/known_related_objects/tests.py
+++ b/tests/known_related_objects/tests.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
from django.test import TestCase
-from .models import Tournament, Organiser, Pool, PoolStyle
+from .models import Organiser, Pool, PoolStyle, Tournament
class ExistingRelatedInstancesTests(TestCase):
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
index 3e4c19ece5..a349e4f35b 100644
--- a/tests/logging_tests/tests.py
+++ b/tests/logging_tests/tests.py
@@ -4,22 +4,21 @@ from __future__ import unicode_literals
import logging
import warnings
+from admin_scripts.tests import AdminScriptTestCase
+
from django.core import mail
from django.core.files.temp import NamedTemporaryFile
-from django.test import TestCase, RequestFactory, override_settings
+from django.test import RequestFactory, TestCase, override_settings
from django.test.utils import patch_logger
-from django.utils.encoding import force_text
from django.utils.deprecation import RemovedInNextVersionWarning
+from django.utils.encoding import force_text
from django.utils.log import (
AdminEmailHandler, CallbackFilter, RequireDebugFalse, RequireDebugTrue,
)
from django.utils.six import StringIO
-from admin_scripts.tests import AdminScriptTestCase
-
from .logconfig import MyEmailBackend
-
# logging config prior to using filter with mail_admins
OLD_LOGGING = {
'version': 1,
diff --git a/tests/logging_tests/views.py b/tests/logging_tests/views.py
index c685bcc005..77186be329 100644
--- a/tests/logging_tests/views.py
+++ b/tests/logging_tests/views.py
@@ -1,6 +1,6 @@
from __future__ import unicode_literals
-from django.core.exceptions import SuspiciousOperation, DisallowedHost
+from django.core.exceptions import DisallowedHost, SuspiciousOperation
def suspicious(request):
diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py
index 8dabfb2c18..36b60a033d 100644
--- a/tests/lookup/tests.py
+++ b/tests/lookup/tests.py
@@ -8,7 +8,7 @@ from django.core.exceptions import FieldError
from django.db import connection
from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature
-from .models import Author, Article, Tag, Game, Season, Player, MyISAMArticle
+from .models import Article, Author, Game, MyISAMArticle, Player, Season, Tag
class LookupTests(TestCase):
diff --git a/tests/m2m_and_m2o/tests.py b/tests/m2m_and_m2o/tests.py
index 2317f62300..2c84a7f2d4 100644
--- a/tests/m2m_and_m2o/tests.py
+++ b/tests/m2m_and_m2o/tests.py
@@ -1,7 +1,7 @@
from django.db.models import Q
from django.test import TestCase
-from .models import Issue, User, UnicodeReferenceModel
+from .models import Issue, UnicodeReferenceModel, User
class RelatedObjectTests(TestCase):
diff --git a/tests/m2m_intermediary/tests.py b/tests/m2m_intermediary/tests.py
index d9c77ecb7c..ce4e186004 100644
--- a/tests/m2m_intermediary/tests.py
+++ b/tests/m2m_intermediary/tests.py
@@ -5,7 +5,7 @@ from datetime import datetime
from django.test import TestCase
from django.utils import six
-from .models import Reporter, Article, Writer
+from .models import Article, Reporter, Writer
class M2MIntermediaryTests(TestCase):
diff --git a/tests/m2m_regress/tests.py b/tests/m2m_regress/tests.py
index b1adc53952..885efa593f 100644
--- a/tests/m2m_regress/tests.py
+++ b/tests/m2m_regress/tests.py
@@ -4,8 +4,10 @@ from django.core.exceptions import FieldError
from django.test import TestCase
from django.utils import six
-from .models import (SelfRefer, Tag, TagCollection, Entry, SelfReferChild,
- SelfReferChildSibling, Worksheet, RegressionModelSplit)
+from .models import (
+ Entry, RegressionModelSplit, SelfRefer, SelfReferChild,
+ SelfReferChildSibling, Tag, TagCollection, Worksheet,
+)
class M2MRegressionTests(TestCase):
diff --git a/tests/m2m_signals/tests.py b/tests/m2m_signals/tests.py
index f41f6efd8e..514dec78c9 100644
--- a/tests/m2m_signals/tests.py
+++ b/tests/m2m_signals/tests.py
@@ -5,7 +5,7 @@ Testing signals emitted on changing m2m relations.
from django.db import models
from django.test import TestCase
-from .models import Part, Car, SportsCar, Person
+from .models import Car, Part, Person, SportsCar
class ManyToManySignalsTest(TestCase):
diff --git a/tests/m2m_through/tests.py b/tests/m2m_through/tests.py
index 80c1e6c393..f8149b7c1f 100644
--- a/tests/m2m_through/tests.py
+++ b/tests/m2m_through/tests.py
@@ -5,9 +5,11 @@ from operator import attrgetter
from django.test import TestCase
-from .models import (Person, Group, Membership, CustomMembership,
- PersonSelfRefM2M, Friendship, Event, Invitation, Employee, Relationship,
- Ingredient, Recipe, RecipeIngredient)
+from .models import (
+ CustomMembership, Employee, Event, Friendship, Group, Ingredient,
+ Invitation, Membership, Person, PersonSelfRefM2M, Recipe, RecipeIngredient,
+ Relationship,
+)
class M2mThroughTests(TestCase):
diff --git a/tests/m2m_through_regress/tests.py b/tests/m2m_through_regress/tests.py
index c5f56a5d62..f283c658b8 100644
--- a/tests/m2m_through_regress/tests.py
+++ b/tests/m2m_through_regress/tests.py
@@ -1,12 +1,13 @@
from __future__ import unicode_literals
-from django.core import management
from django.contrib.auth.models import User
+from django.core import management
from django.test import TestCase
from django.utils.six import StringIO
-from .models import (Person, Group, Membership, UserMembership, Car, Driver,
- CarDriver)
+from .models import (
+ Car, CarDriver, Driver, Group, Membership, Person, UserMembership,
+)
class M2MThroughTestCase(TestCase):
diff --git a/tests/mail/tests.py b/tests/mail/tests.py
index 683f47fe31..b6170068fb 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -2,24 +2,25 @@
from __future__ import unicode_literals
import asyncore
-from email.mime.text import MIMEText
import os
import shutil
import smtpd
import sys
import tempfile
import threading
-from smtplib import SMTPException, SMTP
+from email.mime.text import MIMEText
+from smtplib import SMTP, SMTPException
from ssl import SSLError
from django.core import mail
-from django.core.mail import (EmailMessage, mail_admins, mail_managers,
- EmailMultiAlternatives, send_mail, send_mass_mail)
-from django.core.mail.backends import console, dummy, locmem, filebased, smtp
+from django.core.mail import (
+ EmailMessage, EmailMultiAlternatives, mail_admins, mail_managers,
+ send_mail, send_mass_mail,
+)
+from django.core.mail.backends import console, dummy, filebased, locmem, smtp
from django.core.mail.message import BadHeaderError
-from django.test import SimpleTestCase
-from django.test import override_settings
-from django.utils.encoding import force_text, force_bytes
+from django.test import SimpleTestCase, override_settings
+from django.utils.encoding import force_bytes, force_text
from django.utils.six import PY3, StringIO, binary_type
from django.utils.translation import ugettext_lazy
diff --git a/tests/managers_regress/models.py b/tests/managers_regress/models.py
index 99494448bd..16849ed913 100644
--- a/tests/managers_regress/models.py
+++ b/tests/managers_regress/models.py
@@ -3,11 +3,11 @@ Various edge-cases for model managers.
"""
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
-from django.utils.encoding import python_2_unicode_compatible, force_text
+from django.utils.encoding import force_text, python_2_unicode_compatible
class OnlyFred(models.Manager):
diff --git a/tests/managers_regress/tests.py b/tests/managers_regress/tests.py
index af507f0b75..6f70314cb7 100644
--- a/tests/managers_regress/tests.py
+++ b/tests/managers_regress/tests.py
@@ -7,18 +7,8 @@ from django.test import TestCase, override_settings
from django.utils.encoding import force_text
from .models import (
- Child1,
- Child2,
- Child3,
- Child4,
- Child5,
- Child6,
- Child7,
- AbstractBase1,
- AbstractBase2,
- AbstractBase3,
- RelatedModel,
- RelationModel,
+ AbstractBase1, AbstractBase2, AbstractBase3, Child1, Child2, Child3,
+ Child4, Child5, Child6, Child7, RelatedModel, RelationModel,
)
diff --git a/tests/many_to_one/tests.py b/tests/many_to_one/tests.py
index b66cfde9ed..fdb77b4711 100644
--- a/tests/many_to_one/tests.py
+++ b/tests/many_to_one/tests.py
@@ -1,14 +1,16 @@
-from copy import deepcopy
import datetime
+from copy import deepcopy
-from django.core.exceptions import MultipleObjectsReturned, FieldError
+from django.core.exceptions import FieldError, MultipleObjectsReturned
from django.db import models, transaction
from django.test import TestCase
from django.utils import six
from django.utils.translation import ugettext_lazy
-from .models import (Article, Reporter, First, Third, Parent, Child,
- ToFieldChild, Category, Record, Relation, School, Student)
+from .models import (
+ Article, Category, Child, First, Parent, Record, Relation, Reporter,
+ School, Student, Third, ToFieldChild,
+)
class ManyToOneTests(TestCase):
diff --git a/tests/max_lengths/tests.py b/tests/max_lengths/tests.py
index 64edaa6f59..fa3cd4bddc 100644
--- a/tests/max_lengths/tests.py
+++ b/tests/max_lengths/tests.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
import unittest
-from .models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths
+from .models import PersonWithCustomMaxLengths, PersonWithDefaultMaxLengths
class MaxLengthArgumentsTests(unittest.TestCase):
diff --git a/tests/middleware/test_security.py b/tests/middleware/test_security.py
index 66cbf5f7b2..7c0d50491a 100644
--- a/tests/middleware/test_security.py
+++ b/tests/middleware/test_security.py
@@ -1,5 +1,5 @@
from django.http import HttpResponse
-from django.test import TestCase, RequestFactory
+from django.test import RequestFactory, TestCase
from django.test.utils import override_settings
diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py
index c7620732b5..1490094ef7 100644
--- a/tests/middleware/tests.py
+++ b/tests/middleware/tests.py
@@ -2,22 +2,24 @@
from __future__ import unicode_literals
import gzip
-from io import BytesIO
import random
import re
+from io import BytesIO
from unittest import skipIf
from django.conf import settings
from django.core import mail
from django.http import (
- HttpRequest, HttpResponse, StreamingHttpResponse, FileResponse,
- HttpResponseRedirect, HttpResponsePermanentRedirect,
+ FileResponse, HttpRequest, HttpResponse, HttpResponsePermanentRedirect,
+ HttpResponseRedirect, StreamingHttpResponse,
)
from django.middleware.clickjacking import XFrameOptionsMiddleware
-from django.middleware.common import CommonMiddleware, BrokenLinkEmailsMiddleware
-from django.middleware.http import ConditionalGetMiddleware
+from django.middleware.common import (
+ BrokenLinkEmailsMiddleware, CommonMiddleware,
+)
from django.middleware.gzip import GZipMiddleware
-from django.test import TestCase, RequestFactory, override_settings
+from django.middleware.http import ConditionalGetMiddleware
+from django.test import RequestFactory, TestCase, override_settings
from django.test.utils import patch_logger
from django.utils import six
from django.utils.encoding import force_str
diff --git a/tests/middleware/views.py b/tests/middleware/views.py
index c1ee23e893..50e23d1782 100644
--- a/tests/middleware/views.py
+++ b/tests/middleware/views.py
@@ -1,5 +1,5 @@
-from django.http import HttpResponse
-
-
-def empty_view(request, *args, **kwargs):
- return HttpResponse('')
+from django.http import HttpResponse
+
+
+def empty_view(request, *args, **kwargs):
+ return HttpResponse('')
diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py
index 9c7a24ec22..3e6cbb747c 100644
--- a/tests/middleware_exceptions/tests.py
+++ b/tests/middleware_exceptions/tests.py
@@ -4,8 +4,8 @@ from django.conf import settings
from django.core.exceptions import MiddlewareNotUsed
from django.core.signals import got_request_exception
from django.http import HttpResponse
-from django.template.response import TemplateResponse
from django.template import engines
+from django.template.response import TemplateResponse
from django.test import RequestFactory, TestCase, override_settings
from django.test.utils import patch_logger
diff --git a/tests/migrate_signals/tests.py b/tests/migrate_signals/tests.py
index adb721e074..2e729fec41 100644
--- a/tests/migrate_signals/tests.py
+++ b/tests/migrate_signals/tests.py
@@ -1,10 +1,9 @@
from django.apps import apps
from django.core import management
from django.db.models import signals
-from django.test import override_settings, TestCase
+from django.test import TestCase, override_settings
from django.utils import six
-
APP_CONFIG = apps.get_app_config('migrate_signals')
PRE_MIGRATE_ARGS = ['app_config', 'verbosity', 'interactive', 'using']
MIGRATE_DATABASE = 'default'
diff --git a/tests/migration_test_data_persistence/migrations/0001_initial.py b/tests/migration_test_data_persistence/migrations/0001_initial.py
index d49c47b188..6c19c4c81c 100644
--- a/tests/migration_test_data_persistence/migrations/0001_initial.py
+++ b/tests/migration_test_data_persistence/migrations/0001_initial.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migration_test_data_persistence/tests.py b/tests/migration_test_data_persistence/tests.py
index 0b6369db4b..316cd21965 100644
--- a/tests/migration_test_data_persistence/tests.py
+++ b/tests/migration_test_data_persistence/tests.py
@@ -1,4 +1,5 @@
-from django.test import TransactionTestCase, TestCase
+from django.test import TestCase, TransactionTestCase
+
from .models import Book
diff --git a/tests/migrations/deprecated_field_migrations/0001_initial.py b/tests/migrations/deprecated_field_migrations/0001_initial.py
index 724f973405..624ea68016 100644
--- a/tests/migrations/deprecated_field_migrations/0001_initial.py
+++ b/tests/migrations/deprecated_field_migrations/0001_initial.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0001_initial.py
index c20e811696..09cda3c61f 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0001_initial.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0001_initial.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0002_a2.py b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0002_a2.py
index 0c75368e04..e528f9ee5e 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0002_a2.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0002_a2.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0003_a3.py b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0003_a3.py
index 655ea03216..34f3c6c062 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0003_a3.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0003_a3.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0004_a4.py b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0004_a4.py
index c45faf587f..5a1ebfb684 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0004_a4.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_a/migrations/0004_a4.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0001_initial.py
index 67dafcae28..9cd50e24b8 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0001_initial.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0001_initial.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0002_b2.py b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0002_b2.py
index 7972ef8d84..70ba124a0d 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0002_b2.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0002_b2.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0003_b3.py b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0003_b3.py
index f5147c4f7f..746c49d0a1 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0003_b3.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_b/migrations/0003_b3.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0001_initial.py b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0001_initial.py
index c2e46bee70..bf9ec3d171 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0001_initial.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0001_initial.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0002_c2.py b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0002_c2.py
index 1f7f440d83..12942c23b1 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0002_c2.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0002_c2.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0003_c3.py b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0003_c3.py
index d4d48fc32f..f226cad458 100644
--- a/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0003_c3.py
+++ b/tests/migrations/migrations_test_apps/lookuperror_c/migrations/0003_c3.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/migrations_test_apps/unmigrated_app/models.py b/tests/migrations/migrations_test_apps/unmigrated_app/models.py
index c44e922d38..a06b4ac159 100644
--- a/tests/migrations/migrations_test_apps/unmigrated_app/models.py
+++ b/tests/migrations/migrations_test_apps/unmigrated_app/models.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+
from django.db import models
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
index 9c878a2bea..3d822072ce 100644
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
from django.conf import settings
-from django.test import TestCase, mock, override_settings
+from django.contrib.auth.models import AbstractBaseUser
+from django.db import connection, models
from django.db.migrations.autodetector import MigrationAutodetector
-from django.db.migrations.questioner import MigrationQuestioner
-from django.db.migrations.state import ProjectState, ModelState
from django.db.migrations.graph import MigrationGraph
from django.db.migrations.loader import MigrationLoader
-from django.db import models, connection
-from django.contrib.auth.models import AbstractBaseUser
+from django.db.migrations.questioner import MigrationQuestioner
+from django.db.migrations.state import ModelState, ProjectState
+from django.test import TestCase, mock, override_settings
from .models import FoodManager, FoodQuerySet
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index 0f86289cff..d69936636b 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -7,8 +7,8 @@ import os
import shutil
from django.apps import apps
+from django.core.management import CommandError, call_command
from django.db import connection, models
-from django.core.management import call_command, CommandError
from django.db.migrations import questioner
from django.test import ignore_warnings, mock, override_settings
from django.utils import six
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py
index 12385ac7da..e6482fb830 100644
--- a/tests/migrations/test_executor.py
+++ b/tests/migrations/test_executor.py
@@ -1,8 +1,8 @@
+from django.apps.registry import apps as global_apps
from django.db import connection
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.graph import MigrationGraph
-from django.test import modify_settings, override_settings, TestCase
-from django.apps.registry import apps as global_apps
+from django.test import TestCase, modify_settings, override_settings
from .test_base import MigrationTestBase
diff --git a/tests/migrations/test_graph.py b/tests/migrations/test_graph.py
index 89ad206897..cfb61d355f 100644
--- a/tests/migrations/test_graph.py
+++ b/tests/migrations/test_graph.py
@@ -1,5 +1,7 @@
+from django.db.migrations.graph import (
+ CircularDependencyError, MigrationGraph, NodeNotFoundError,
+)
from django.test import TestCase
-from django.db.migrations.graph import CircularDependencyError, MigrationGraph, NodeNotFoundError
from django.utils.encoding import force_text
diff --git a/tests/migrations/test_loader.py b/tests/migrations/test_loader.py
index 8df7b7aa9b..b189da0721 100644
--- a/tests/migrations/test_loader.py
+++ b/tests/migrations/test_loader.py
@@ -2,12 +2,11 @@ from __future__ import unicode_literals
from unittest import skipIf
-from django.test import TestCase, override_settings
from django.db import connection, connections
from django.db.migrations.graph import NodeNotFoundError
-from django.db.migrations.loader import MigrationLoader, AmbiguityError
+from django.db.migrations.loader import AmbiguityError, MigrationLoader
from django.db.migrations.recorder import MigrationRecorder
-from django.test import modify_settings
+from django.test import TestCase, modify_settings, override_settings
from django.utils import six
diff --git a/tests/migrations/test_migrations_custom_user/0001_initial.py b/tests/migrations/test_migrations_custom_user/0001_initial.py
index d7c37151f1..3a4523277d 100644
--- a/tests/migrations/test_migrations_custom_user/0001_initial.py
+++ b/tests/migrations/test_migrations_custom_user/0001_initial.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import migrations, models
from django.conf import settings
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/test_migrations_no_changes/0003_third.py b/tests/migrations/test_migrations_no_changes/0003_third.py
index 2418bd5e9f..05b7535dc3 100644
--- a/tests/migrations/test_migrations_no_changes/0003_third.py
+++ b/tests/migrations/test_migrations_no_changes/0003_third.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/test_migrations_no_default/0001_initial.py b/tests/migrations/test_migrations_no_default/0001_initial.py
index c30910e056..2fd027f2d2 100644
--- a/tests/migrations/test_migrations_no_default/0001_initial.py
+++ b/tests/migrations/test_migrations_no_default/0001_initial.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/migrations/test_multidb.py b/tests/migrations/test_multidb.py
index dec1d25dd0..90e03a400e 100644
--- a/tests/migrations/test_multidb.py
+++ b/tests/migrations/test_multidb.py
@@ -1,16 +1,16 @@
import unittest
-try:
- import sqlparse
-except ImportError:
- sqlparse = None
-
-from django.db import migrations, models, connection
+from django.db import connection, migrations, models
from django.db.migrations.state import ProjectState
from django.test import override_settings
from .test_operations import OperationTestBase
+try:
+ import sqlparse
+except ImportError:
+ sqlparse = None
+
class AgnosticRouter(object):
"""
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index d8a042d4ba..d27ca5eeb5 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -2,11 +2,6 @@ from __future__ import unicode_literals
import unittest
-try:
- import sqlparse
-except ImportError:
- sqlparse = None
-
from django.db import connection, migrations, models, transaction
from django.db.migrations.migration import Migration
from django.db.migrations.state import ProjectState
@@ -19,6 +14,11 @@ from django.utils import six
from .models import FoodManager, FoodQuerySet
from .test_base import MigrationTestBase
+try:
+ import sqlparse
+except ImportError:
+ sqlparse = None
+
class OperationTestBase(MigrationTestBase):
"""
diff --git a/tests/migrations/test_optimizer.py b/tests/migrations/test_optimizer.py
index cb89a85c2d..e639752082 100644
--- a/tests/migrations/test_optimizer.py
+++ b/tests/migrations/test_optimizer.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
-from django.test import TestCase
+from django.db import migrations, models
from django.db.migrations.optimizer import MigrationOptimizer
-from django.db import migrations
-from django.db import models
+from django.test import TestCase
from .models import CustomModelBase, EmptyManager
diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py
index a7dbdbe11c..7db3565657 100644
--- a/tests/migrations/test_state.py
+++ b/tests/migrations/test_state.py
@@ -1,11 +1,14 @@
from django.apps.registry import Apps
from django.db import models
from django.db.migrations.operations import RemoveField
-from django.db.migrations.state import ProjectState, ModelState, InvalidBasesError
+from django.db.migrations.state import (
+ InvalidBasesError, ModelState, ProjectState,
+)
from django.test import TestCase
-from .models import (FoodManager, FoodQuerySet, ModelWithCustomBase,
- NoMigrationFoodManager)
+from .models import (
+ FoodManager, FoodQuerySet, ModelWithCustomBase, NoMigrationFoodManager,
+)
class StateTests(TestCase):
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
index 6c6a654365..38065fbb1a 100644
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -8,20 +8,22 @@ import re
import tokenize
import unittest
-from django.core.validators import RegexValidator, EmailValidator
-from django.db import models, migrations
-from django.db.migrations.writer import MigrationWriter, OperationWriter, SettingsReference
-from django.test import SimpleTestCase, TestCase, ignore_warnings
+import custom_migration_operations.more_operations
+import custom_migration_operations.operations
+
from django.conf import settings
+from django.core.validators import EmailValidator, RegexValidator
+from django.db import migrations, models
+from django.db.migrations.writer import (
+ MigrationWriter, OperationWriter, SettingsReference,
+)
+from django.test import SimpleTestCase, TestCase, ignore_warnings
from django.utils import datetime_safe, six
from django.utils.deconstruct import deconstructible
+from django.utils.timezone import FixedOffset, get_default_timezone, utc
from django.utils.translation import ugettext_lazy as _
-from django.utils.timezone import get_default_timezone, utc, FixedOffset
-
-import custom_migration_operations.operations
-import custom_migration_operations.more_operations
-from .models import FoodQuerySet, FoodManager
+from .models import FoodManager, FoodQuerySet
class TestModel1(object):
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py
index 9a6a3f1f36..ee2f807146 100644
--- a/tests/model_fields/models.py
+++ b/tests/model_fields/models.py
@@ -2,21 +2,23 @@ import os
import tempfile
import uuid
-try:
- from PIL import Image
-except ImportError:
- Image = None
-
-from django.core.files.storage import FileSystemStorage
-from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
+from django.contrib.contenttypes.fields import (
+ GenericForeignKey, GenericRelation,
+)
from django.contrib.contenttypes.models import ContentType
+from django.core.files.storage import FileSystemStorage
+from django.db import models
+from django.db.models.fields.files import ImageField, ImageFieldFile
from django.db.models.fields.related import (
- ForeignObject, ForeignKey, ManyToManyField, OneToOneField,
+ ForeignKey, ForeignObject, ManyToManyField, OneToOneField,
)
-from django.db import models
-from django.db.models.fields.files import ImageFieldFile, ImageField
from django.utils import six
+try:
+ from PIL import Image
+except ImportError:
+ Image = None
+
class Foo(models.Model):
a = models.CharField(max_length=10)
diff --git a/tests/model_fields/test_field_flags.py b/tests/model_fields/test_field_flags.py
index 08a57db501..3749e55452 100644
--- a/tests/model_fields/test_field_flags.py
+++ b/tests/model_fields/test_field_flags.py
@@ -1,17 +1,15 @@
from django import test
-
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.db import models
from django.db.models.fields.related import (
- ForeignObject, ForeignKey, OneToOneField, ManyToManyField,
- ManyToOneRel, ForeignObjectRel,
+ ForeignKey, ForeignObject, ForeignObjectRel, ManyToManyField, ManyToOneRel,
+ OneToOneField,
)
from .models import AllFieldsModel
-
NON_CONCRETE_FIELDS = (
ForeignObject,
GenericForeignKey,
diff --git a/tests/model_fields/test_uuid.py b/tests/model_fields/test_uuid.py
index d2ffe71a3a..4680d5dbb4 100644
--- a/tests/model_fields/test_uuid.py
+++ b/tests/model_fields/test_uuid.py
@@ -5,7 +5,7 @@ from django.core import exceptions, serializers
from django.db import models
from django.test import TestCase
-from .models import UUIDModel, NullableUUIDModel, PrimaryKeyUUIDModel
+from .models import NullableUUIDModel, PrimaryKeyUUIDModel, UUIDModel
class TestSaveLoad(TestCase):
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 5c8c8109d1..8894ef9158 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -1,22 +1,21 @@
from __future__ import unicode_literals
import datetime
-from decimal import Decimal
import unittest
+from decimal import Decimal
-from django import test
-from django import forms
-from django.core import validators
-from django.core import checks
+from django import forms, test
+from django.core import checks, validators
from django.core.exceptions import ValidationError
-from django.db import connection, transaction, models, IntegrityError
+from django.db import IntegrityError, connection, models, transaction
from django.db.models.fields import (
- AutoField, BigIntegerField, BinaryField, BooleanField, CharField,
- CommaSeparatedIntegerField, DateField, DateTimeField, DecimalField,
- EmailField, FilePathField, FloatField, IntegerField, IPAddressField,
- GenericIPAddressField, NOT_PROVIDED, NullBooleanField, PositiveIntegerField,
+ NOT_PROVIDED, AutoField, BigIntegerField, BinaryField, BooleanField,
+ CharField, CommaSeparatedIntegerField, DateField, DateTimeField,
+ DecimalField, EmailField, FilePathField, FloatField, GenericIPAddressField,
+ IntegerField, IPAddressField, NullBooleanField, PositiveIntegerField,
PositiveSmallIntegerField, SlugField, SmallIntegerField, TextField,
- TimeField, URLField)
+ TimeField, URLField,
+)
from django.db.models.fields.files import FileField, ImageField
from django.utils import six
from django.utils.functional import lazy
@@ -24,9 +23,10 @@ from django.utils.functional import lazy
from .models import (
Bar, BigD, BigIntegerModel, BigS, BooleanModel, DataModel, DateTimeModel,
Document, FksToBooleans, FkToChar, FloatModel, Foo, GenericIPAddress,
- IntegerModel, NullBooleanModel, PositiveIntegerModel, PositiveSmallIntegerModel,
- Post, PrimaryKeyCharModel, RenamedField, SmallIntegerModel, VerboseNameField,
- Whiz, WhizIter, WhizIterEmpty)
+ IntegerModel, NullBooleanModel, PositiveIntegerModel,
+ PositiveSmallIntegerModel, Post, PrimaryKeyCharModel, RenamedField,
+ SmallIntegerModel, VerboseNameField, Whiz, WhizIter, WhizIterEmpty,
+)
class BasicFieldTests(test.TestCase):
diff --git a/tests/model_forms/models.py b/tests/model_forms/models.py
index d2b55c4e10..ac3c6062a2 100644
--- a/tests/model_forms/models.py
+++ b/tests/model_forms/models.py
@@ -17,10 +17,9 @@ from django.core.exceptions import ValidationError
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.utils import six
+from django.utils._os import upath
from django.utils.encoding import python_2_unicode_compatible
from django.utils.six.moves import range
-from django.utils._os import upath
-
temp_storage_dir = tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR'])
temp_storage = FileSystemStorage(temp_storage_dir)
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index 4bb7c47eb2..82fc0925d0 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -6,25 +6,31 @@ from decimal import Decimal
from unittest import skipUnless
from django import forms
-from django.core.exceptions import FieldError, ImproperlyConfigured, NON_FIELD_ERRORS
+from django.core.exceptions import (
+ NON_FIELD_ERRORS, FieldError, ImproperlyConfigured,
+)
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import ValidationError
from django.db import connection
from django.db.models.query import EmptyQuerySet
-from django.forms.models import (construct_instance, fields_for_model,
- model_to_dict, modelform_factory, ModelFormMetaclass)
-from django.template import Template, Context
+from django.forms.models import (
+ ModelFormMetaclass, construct_instance, fields_for_model, model_to_dict,
+ modelform_factory,
+)
+from django.template import Context, Template
from django.test import TestCase, skipUnlessDBFeature
-from django.utils._os import upath
from django.utils import six
+from django.utils._os import upath
-from .models import (Article, ArticleStatus, Author, Author1, BetterWriter, BigInt, Book,
- Category, CommaSeparatedInteger, CustomFF, CustomFieldForExclusionModel,
- DerivedBook, DerivedPost, Document, ExplicitPK, FilePathModel, FlexibleDatePost, Homepage,
- ImprovedArticle, ImprovedArticleWithParentLink, Inventory, Person, Photo, Post, Price,
- Product, Publication, TextFile, Triple, Writer, WriterProfile,
- Colour, ColourfulItem, DateTimePost, CustomErrorMessage,
- test_images, StumpJoke, Character, Student)
+from .models import (
+ Article, ArticleStatus, Author, Author1, BetterWriter, BigInt, Book,
+ Category, Character, Colour, ColourfulItem, CommaSeparatedInteger,
+ CustomErrorMessage, CustomFF, CustomFieldForExclusionModel, DateTimePost,
+ DerivedBook, DerivedPost, Document, ExplicitPK, FilePathModel,
+ FlexibleDatePost, Homepage, ImprovedArticle, ImprovedArticleWithParentLink,
+ Inventory, Person, Photo, Post, Price, Product, Publication, Student,
+ StumpJoke, TextFile, Triple, Writer, WriterProfile, test_images,
+)
if test_images:
from .models import ImageFile, OptionalImageFile
diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py
index acd05c9bf2..2d0380195b 100644
--- a/tests/model_formsets/tests.py
+++ b/tests/model_formsets/tests.py
@@ -8,16 +8,20 @@ from decimal import Decimal
from django import forms
from django.core.exceptions import ImproperlyConfigured
from django.db import models
-from django.forms.models import (_get_foreign_key, inlineformset_factory,
- modelformset_factory, BaseModelFormSet)
+from django.forms.models import (
+ BaseModelFormSet, _get_foreign_key, inlineformset_factory,
+ modelformset_factory,
+)
from django.test import TestCase, skipUnlessDBFeature
from django.utils import six
-from .models import (Author, BetterAuthor, Book, BookWithCustomPK,
- BookWithOptionalAltEditor, AlternateBook, AuthorMeeting, CustomPrimaryKey,
- Place, Owner, Location, OwnerProfile, Restaurant, Product, Price,
- MexicanRestaurant, ClassyMexicanRestaurant, Repository, Revision,
- Person, Membership, Team, Player, Poet, Poem, Post)
+from .models import (
+ AlternateBook, Author, AuthorMeeting, BetterAuthor, Book, BookWithCustomPK,
+ BookWithOptionalAltEditor, ClassyMexicanRestaurant, CustomPrimaryKey,
+ Location, Membership, MexicanRestaurant, Owner, OwnerProfile, Person,
+ Place, Player, Poem, Poet, Post, Price, Product, Repository, Restaurant,
+ Revision, Team,
+)
class DeletionTests(TestCase):
diff --git a/tests/model_formsets_regress/tests.py b/tests/model_formsets_regress/tests.py
index 8982efed51..d9e87ec046 100644
--- a/tests/model_formsets_regress/tests.py
+++ b/tests/model_formsets_regress/tests.py
@@ -1,15 +1,18 @@
from __future__ import unicode_literals
from django import forms
-from django.forms.formsets import BaseFormSet, DELETION_FIELD_NAME
+from django.forms.formsets import DELETION_FIELD_NAME, BaseFormSet
+from django.forms.models import (
+ BaseModelFormSet, inlineformset_factory, modelform_factory,
+ modelformset_factory,
+)
from django.forms.utils import ErrorDict, ErrorList
-from django.forms.models import modelform_factory, inlineformset_factory, modelformset_factory, BaseModelFormSet
from django.test import TestCase
from django.utils import six
from .models import (
- User, UserSite, UserProfile, ProfileNetwork, Restaurant, Manager, Network,
- Host,
+ Host, Manager, Network, ProfileNetwork, Restaurant, User, UserProfile,
+ UserSite,
)
diff --git a/tests/model_inheritance/models.py b/tests/model_inheritance/models.py
index af28159757..a77ab15f70 100644
--- a/tests/model_inheritance/models.py
+++ b/tests/model_inheritance/models.py
@@ -16,6 +16,7 @@ from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
+
#
# Abstract base classes
#
diff --git a/tests/model_inheritance/same_model_name/models.py b/tests/model_inheritance/same_model_name/models.py
index 307a505ee6..6b45e28dfe 100644
--- a/tests/model_inheritance/same_model_name/models.py
+++ b/tests/model_inheritance/same_model_name/models.py
@@ -5,9 +5,9 @@ requiring an %(app_label)s format string. This app tests this feature by
redefining the Copy model from model_inheritance/models.py.
"""
-from django.db import models
-
from model_inheritance.models import NamedURL
+
+from django.db import models
from django.utils.encoding import python_2_unicode_compatible
diff --git a/tests/model_inheritance/tests.py b/tests/model_inheritance/tests.py
index a732464e69..3c4f71d934 100644
--- a/tests/model_inheritance/tests.py
+++ b/tests/model_inheritance/tests.py
@@ -10,9 +10,10 @@ from django.test.utils import CaptureQueriesContext
from django.utils import six
from .models import (
- Chef, CommonInfo, ItalianRestaurant, ParkingLot, Place, Post,
- Restaurant, Student, Supplier, Worker, MixinModel,
- Title, Copy, Base, SubBase, GrandParent, GrandChild)
+ Base, Chef, CommonInfo, Copy, GrandChild, GrandParent, ItalianRestaurant,
+ MixinModel, ParkingLot, Place, Post, Restaurant, Student, SubBase,
+ Supplier, Title, Worker,
+)
class ModelInheritanceTests(TestCase):
diff --git a/tests/model_inheritance_regress/tests.py b/tests/model_inheritance_regress/tests.py
index 7e1c4b81bf..6d916bf6e4 100644
--- a/tests/model_inheritance_regress/tests.py
+++ b/tests/model_inheritance_regress/tests.py
@@ -10,12 +10,14 @@ from unittest import expectedFailure
from django import forms
from django.test import TestCase
-from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
- ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent,
- SelfRefChild, ArticleWithAuthor, M2MChild, QualityControl, DerivedM,
- Person, BirthdayParty, BachelorParty, MessyBachelorParty,
- InternalCertificationAudit, BusStation, TrainStation, User, Profile,
- ParkingLot4A, ParkingLot4B, Senator)
+from .models import (
+ ArticleWithAuthor, BachelorParty, BirthdayParty, BusStation, Child,
+ DerivedM, InternalCertificationAudit, ItalianRestaurant, M2MChild,
+ MessyBachelorParty, ParkingLot, ParkingLot2, ParkingLot3, ParkingLot4A,
+ ParkingLot4B, Person, Place, Profile, QualityControl, Restaurant,
+ SelfRefChild, SelfRefParent, Senator, Supplier, TrainStation, User,
+ Wholesaler,
+)
class ModelInheritanceTest(TestCase):
diff --git a/tests/model_meta/models.py b/tests/model_meta/models.py
index b4ed9f89d2..6ce36ed9d6 100644
--- a/tests/model_meta/models.py
+++ b/tests/model_meta/models.py
@@ -1,7 +1,8 @@
-from django.db import models
-
-from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
+from django.contrib.contenttypes.fields import (
+ GenericForeignKey, GenericRelation,
+)
from django.contrib.contenttypes.models import ContentType
+from django.db import models
class Relation(models.Model):
diff --git a/tests/model_meta/results.py b/tests/model_meta/results.py
index 1efc49ed23..d70963206f 100644
--- a/tests/model_meta/results.py
+++ b/tests/model_meta/results.py
@@ -1,6 +1,4 @@
-from .models import (
- AbstractPerson, BasePerson, Person, Relating, Relation,
-)
+from .models import AbstractPerson, BasePerson, Person, Relating, Relation
TEST_RESULTS = {
'get_all_field_names': {
diff --git a/tests/model_meta/test_legacy.py b/tests/model_meta/test_legacy.py
index 60bfb1641f..c319f28fcc 100644
--- a/tests/model_meta/test_legacy.py
+++ b/tests/model_meta/test_legacy.py
@@ -3,7 +3,7 @@ import warnings
from django import test
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import FieldDoesNotExist
-from django.db.models.fields import related, CharField
+from django.db.models.fields import CharField, related
from django.utils.deprecation import RemovedInDjango20Warning
from .models import BasePerson, Person
diff --git a/tests/model_meta/tests.py b/tests/model_meta/tests.py
index 36b65f5ab8..4a08b408c6 100644
--- a/tests/model_meta/tests.py
+++ b/tests/model_meta/tests.py
@@ -1,13 +1,15 @@
from django.apps import apps
-from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
+from django.contrib.contenttypes.fields import (
+ GenericForeignKey, GenericRelation,
+)
from django.core.exceptions import FieldDoesNotExist
-from django.db.models.fields import related, CharField, Field
-from django.db.models.options import IMMUTABLE_WARNING, EMPTY_RELATION_TREE
+from django.db.models.fields import CharField, Field, related
+from django.db.models.options import EMPTY_RELATION_TREE, IMMUTABLE_WARNING
from django.test import TestCase
from .models import (
- Relation, AbstractPerson, BasePerson, Person, ProxyPerson, Relating,
- CommonAncestor, FirstParent, SecondParent, Child
+ AbstractPerson, BasePerson, Child, CommonAncestor, FirstParent, Person,
+ ProxyPerson, Relating, Relation, SecondParent,
)
from .results import TEST_RESULTS
diff --git a/tests/model_options/models/tablespaces.py b/tests/model_options/models/tablespaces.py
index 56e22e973a..7328a3df6e 100644
--- a/tests/model_options/models/tablespaces.py
+++ b/tests/model_options/models/tablespaces.py
@@ -1,5 +1,6 @@
from django.db import models
+
# Since the test database doesn't have tablespaces, it's impossible for Django
# to create the tables for models where db_tablespace is set. To avoid this
# problem, we mark the models as unmanaged, and temporarily revert them to
diff --git a/tests/model_options/test_default_related_name.py b/tests/model_options/test_default_related_name.py
index 6cdffe5cf9..a30de192cb 100644
--- a/tests/model_options/test_default_related_name.py
+++ b/tests/model_options/test_default_related_name.py
@@ -1,6 +1,6 @@
from django.test import TestCase
-from .models.default_related_name import Author, Editor, Book
+from .models.default_related_name import Author, Book, Editor
class DefaultRelatedNameTests(TestCase):
diff --git a/tests/model_options/test_tablespaces.py b/tests/model_options/test_tablespaces.py
index 515cd8a032..e8372e1bc7 100644
--- a/tests/model_options/test_tablespaces.py
+++ b/tests/model_options/test_tablespaces.py
@@ -5,8 +5,9 @@ from django.conf import settings
from django.db import connection
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
-from .models.tablespaces import (Article, ArticleRef, Authors, Reviewers,
- Scientist, ScientistRef)
+from .models.tablespaces import (
+ Article, ArticleRef, Authors, Reviewers, Scientist, ScientistRef,
+)
def sql_for_table(model):
diff --git a/tests/model_package/tests.py b/tests/model_package/tests.py
index c0a65b2ad6..9d1b81fa2a 100644
--- a/tests/model_package/tests.py
+++ b/tests/model_package/tests.py
@@ -1,11 +1,11 @@
from __future__ import unicode_literals
-from django.db import models, connection
+from django.db import connection, models
from django.db.backends.utils import truncate_name
from django.test import TestCase
-from .models.publication import Publication
from .models.article import Article, Site
+from .models.publication import Publication
class Advertisement(models.Model):
diff --git a/tests/model_permalink/views.py b/tests/model_permalink/views.py
index c1ee23e893..50e23d1782 100644
--- a/tests/model_permalink/views.py
+++ b/tests/model_permalink/views.py
@@ -1,5 +1,5 @@
-from django.http import HttpResponse
-
-
-def empty_view(request, *args, **kwargs):
- return HttpResponse('')
+from django.http import HttpResponse
+
+
+def empty_view(request, *args, **kwargs):
+ return HttpResponse('')
diff --git a/tests/model_regress/models.py b/tests/model_regress/models.py
index c42b0f0d35..b899baf6ea 100644
--- a/tests/model_regress/models.py
+++ b/tests/model_regress/models.py
@@ -4,7 +4,6 @@ from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
-
CHOICES = (
(1, 'first'),
(2, 'second'),
diff --git a/tests/model_regress/test_pickle.py b/tests/model_regress/test_pickle.py
index 64d2f6df5f..9f3725ad18 100644
--- a/tests/model_regress/test_pickle.py
+++ b/tests/model_regress/test_pickle.py
@@ -5,8 +5,8 @@ import subprocess
import sys
import warnings
-from django.db import models, DJANGO_VERSION_PICKLE_KEY
from django.core.files.temp import NamedTemporaryFile
+from django.db import DJANGO_VERSION_PICKLE_KEY, models
from django.test import TestCase
from django.utils.encoding import force_text
from django.utils.version import get_major_version, get_version
diff --git a/tests/model_regress/tests.py b/tests/model_regress/tests.py
index 49ef6b98cd..feb81f32bc 100644
--- a/tests/model_regress/tests.py
+++ b/tests/model_regress/tests.py
@@ -4,14 +4,16 @@ import datetime
from operator import attrgetter
from django.core.exceptions import ValidationError
+from django.db import router
+from django.db.models.sql import InsertQuery
from django.test import TestCase, skipUnlessDBFeature
from django.utils import six
from django.utils.timezone import get_fixed_timezone
-from django.db import router
-from django.db.models.sql import InsertQuery
-from .models import (Worker, Article, Party, Event, Department,
- BrokenUnicodeMethod, NonAutoPK, Model1, Model2, Model3)
+from .models import (
+ Article, BrokenUnicodeMethod, Department, Event, Model1, Model2, Model3,
+ NonAutoPK, Party, Worker,
+)
class ModelTests(TestCase):
diff --git a/tests/model_validation/tests.py b/tests/model_validation/tests.py
index 50ccfd2de6..677e21b37a 100644
--- a/tests/model_validation/tests.py
+++ b/tests/model_validation/tests.py
@@ -1,9 +1,9 @@
from django.core import management
-from django.core.checks import run_checks, Error
+from django.core.checks import Error, run_checks
from django.db.models.signals import post_init
from django.test import TestCase
-from django.utils import six
from django.test.utils import override_settings
+from django.utils import six
class OnPostInit(object):
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py
index 6157d6c1d4..cc9c8f2de0 100644
--- a/tests/modeladmin/tests.py
+++ b/tests/modeladmin/tests.py
@@ -3,19 +3,21 @@ from __future__ import unicode_literals
from datetime import date
from django import forms
-from django.contrib.admin.options import (ModelAdmin, TabularInline,
- HORIZONTAL, VERTICAL)
+from django.contrib.admin import BooleanFieldListFilter, SimpleListFilter
+from django.contrib.admin.options import (
+ HORIZONTAL, VERTICAL, ModelAdmin, TabularInline,
+)
from django.contrib.admin.sites import AdminSite
from django.contrib.admin.widgets import AdminDateWidget, AdminRadioSelect
-from django.contrib.admin import (SimpleListFilter,
- BooleanFieldListFilter)
from django.core.checks import Error
from django.forms.models import BaseModelFormSet
from django.forms.widgets import Select
from django.test import TestCase
from django.utils import six
-from .models import Band, Concert, ValidationTestModel, ValidationTestInlineModel
+from .models import (
+ Band, Concert, ValidationTestInlineModel, ValidationTestModel,
+)
class MockRequest(object):
diff --git a/tests/multiple_database/models.py b/tests/multiple_database/models.py
index e02bb17f27..e5d3e723e4 100644
--- a/tests/multiple_database/models.py
+++ b/tests/multiple_database/models.py
@@ -1,6 +1,6 @@
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py
index e0fc431dd0..5da69b560f 100644
--- a/tests/multiple_database/tests.py
+++ b/tests/multiple_database/tests.py
@@ -7,14 +7,14 @@ from operator import attrgetter
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core import management
-from django.db import connections, router, DEFAULT_DB_ALIAS, transaction
+from django.db import DEFAULT_DB_ALIAS, connections, router, transaction
from django.db.models import signals
from django.db.utils import ConnectionRouter
from django.test import TestCase, override_settings
from django.utils.six import StringIO
from .models import Book, Person, Pet, Review, UserProfile
-from .routers import TestRouter, AuthRouter, WriteRouter
+from .routers import AuthRouter, TestRouter, WriteRouter
class QueryTestCase(TestCase):
diff --git a/tests/nested_foreign_keys/tests.py b/tests/nested_foreign_keys/tests.py
index e08922aefb..80c09810a4 100644
--- a/tests/nested_foreign_keys/tests.py
+++ b/tests/nested_foreign_keys/tests.py
@@ -2,7 +2,9 @@ from __future__ import unicode_literals
from django.test import TestCase
-from .models import Person, Movie, Event, Screening, ScreeningNullFK, Package, PackageNullFK
+from .models import (
+ Event, Movie, Package, PackageNullFK, Person, Screening, ScreeningNullFK,
+)
# These are tests for #16715. The basic scheme is always the same: 3 models with
diff --git a/tests/null_fk/tests.py b/tests/null_fk/tests.py
index 26eae6491e..008c0981e6 100644
--- a/tests/null_fk/tests.py
+++ b/tests/null_fk/tests.py
@@ -3,8 +3,9 @@ from __future__ import unicode_literals
from django.db.models import Q
from django.test import TestCase
-from .models import (SystemDetails, Item, PropertyValue, SystemInfo, Forum,
- Post, Comment)
+from .models import (
+ Comment, Forum, Item, Post, PropertyValue, SystemDetails, SystemInfo,
+)
class NullFkTests(TestCase):
diff --git a/tests/null_fk_ordering/tests.py b/tests/null_fk_ordering/tests.py
index 2fe48f0b19..7215118b94 100644
--- a/tests/null_fk_ordering/tests.py
+++ b/tests/null_fk_ordering/tests.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
from django.test import TestCase
-from .models import Author, Article, SystemInfo, Forum, Post, Comment
+from .models import Article, Author, Comment, Forum, Post, SystemInfo
class NullFkOrderingTests(TestCase):
diff --git a/tests/null_queries/tests.py b/tests/null_queries/tests.py
index 1b73c977b4..8c8ca3f28d 100644
--- a/tests/null_queries/tests.py
+++ b/tests/null_queries/tests.py
@@ -1,9 +1,9 @@
from __future__ import unicode_literals
-from django.test import TestCase
from django.core.exceptions import FieldError
+from django.test import TestCase
-from .models import Poll, Choice, OuterA, Inner, OuterB
+from .models import Choice, Inner, OuterA, OuterB, Poll
class NullQueriesTests(TestCase):
diff --git a/tests/one_to_one/tests.py b/tests/one_to_one/tests.py
index 73d76d4a48..d7d5793b0a 100644
--- a/tests/one_to_one/tests.py
+++ b/tests/one_to_one/tests.py
@@ -1,10 +1,12 @@
from __future__ import unicode_literals
-from django.db import transaction, IntegrityError, connection
+from django.db import IntegrityError, connection, transaction
from django.test import TestCase
-from .models import (Bar, Favorites, HiddenPointer, ManualPrimaryKey, MultiModel,
- Place, RelatedModel, Restaurant, School, Director, Target, UndergroundBar, Waiter)
+from .models import (
+ Bar, Director, Favorites, HiddenPointer, ManualPrimaryKey, MultiModel,
+ Place, RelatedModel, Restaurant, School, Target, UndergroundBar, Waiter,
+)
class OneToOneTests(TestCase):
diff --git a/tests/order_with_respect_to/tests.py b/tests/order_with_respect_to/tests.py
index 8fc09b496b..60181cca4b 100644
--- a/tests/order_with_respect_to/tests.py
+++ b/tests/order_with_respect_to/tests.py
@@ -2,11 +2,10 @@ from __future__ import unicode_literals
from operator import attrgetter
-from django.test import TestCase
-
from django.db import models
+from django.test import TestCase
-from .models import Post, Question, Answer
+from .models import Answer, Post, Question
class OrderWithRespectToTests(TestCase):
diff --git a/tests/pagination/custom.py b/tests/pagination/custom.py
index 47a932c7e3..77277dca5b 100644
--- a/tests/pagination/custom.py
+++ b/tests/pagination/custom.py
@@ -1,4 +1,4 @@
-from django.core.paginator import Paginator, Page
+from django.core.paginator import Page, Paginator
class ValidAdjacentNumsPage(Page):
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py
index 7f405cffaa..0757859628 100644
--- a/tests/pagination/tests.py
+++ b/tests/pagination/tests.py
@@ -1,15 +1,16 @@
from __future__ import unicode_literals
-from datetime import datetime
import unittest
+from datetime import datetime
-from django.core.paginator import (Paginator, EmptyPage, InvalidPage,
- PageNotAnInteger)
+from django.core.paginator import (
+ EmptyPage, InvalidPage, PageNotAnInteger, Paginator,
+)
from django.test import TestCase
from django.utils import six
-from .models import Article
from .custom import ValidAdjacentNumsPaginator
+from .models import Article
class PaginationTests(unittest.TestCase):
diff --git a/tests/postgres_tests/array_default_migrations/0001_initial.py b/tests/postgres_tests/array_default_migrations/0001_initial.py
index 0b7eb77c3d..14734d3670 100644
--- a/tests/postgres_tests/array_default_migrations/0001_initial.py
+++ b/tests/postgres_tests/array_default_migrations/0001_initial.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
import django.contrib.postgres.fields
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py b/tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py
index 074c2f70e5..0ee5a83c5e 100644
--- a/tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py
+++ b/tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
import django.contrib.postgres.fields
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/postgres_tests/migrations/0001_setup_extensions.py b/tests/postgres_tests/migrations/0001_setup_extensions.py
index 0c43974954..0915b74343 100644
--- a/tests/postgres_tests/migrations/0001_setup_extensions.py
+++ b/tests/postgres_tests/migrations/0001_setup_extensions.py
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.contrib.postgres.operations import HStoreExtension, UnaccentExtension
+from django.contrib.postgres.operations import (
+ HStoreExtension, UnaccentExtension,
+)
from django.db import migrations
diff --git a/tests/postgres_tests/migrations/0002_create_test_models.py b/tests/postgres_tests/migrations/0002_create_test_models.py
index 841953d351..c4f031f6d0 100644
--- a/tests/postgres_tests/migrations/0002_create_test_models.py
+++ b/tests/postgres_tests/migrations/0002_create_test_models.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
import django.contrib.postgres.fields
import django.contrib.postgres.fields.hstore
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/postgres_tests/models.py b/tests/postgres_tests/models.py
index 0422aba6a0..f698d56a58 100644
--- a/tests/postgres_tests/models.py
+++ b/tests/postgres_tests/models.py
@@ -1,6 +1,6 @@
from django.contrib.postgres.fields import (
- ArrayField, HStoreField, IntegerRangeField, BigIntegerRangeField,
- FloatRangeField, DateTimeRangeField, DateRangeField,
+ ArrayField, BigIntegerRangeField, DateRangeField, DateTimeRangeField,
+ FloatRangeField, HStoreField, IntegerRangeField,
)
from django.db import connection, models
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index 020b31658f..8edc78d65c 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -3,19 +3,18 @@ import json
import unittest
import uuid
+from django import forms
from django.contrib.postgres.fields import ArrayField
from django.contrib.postgres.forms import SimpleArrayField, SplitArrayField
from django.core import exceptions, serializers
from django.core.management import call_command
-from django.db import models, IntegrityError, connection
-from django import forms
+from django.db import IntegrityError, connection, models
from django.test import TestCase, override_settings
from django.utils import timezone
from .models import (
- IntegerArrayModel, NullableIntegerArrayModel, CharArrayModel,
- DateTimeArrayModel, NestedIntegerArrayModel, OtherTypesArrayModel,
- ArrayFieldSubclass,
+ ArrayFieldSubclass, CharArrayModel, DateTimeArrayModel, IntegerArrayModel,
+ NestedIntegerArrayModel, NullableIntegerArrayModel, OtherTypesArrayModel,
)
diff --git a/tests/postgres_tests/test_ranges.py b/tests/postgres_tests/test_ranges.py
index bc15987ba7..c26382a15b 100644
--- a/tests/postgres_tests/test_ranges.py
+++ b/tests/postgres_tests/test_ranges.py
@@ -2,16 +2,18 @@ import datetime
import json
import unittest
+from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
+
from django import forms
-from django.contrib.postgres import forms as pg_forms, fields as pg_fields
-from django.contrib.postgres.validators import RangeMaxValueValidator, RangeMinValueValidator
+from django.contrib.postgres import fields as pg_fields, forms as pg_forms
+from django.contrib.postgres.validators import (
+ RangeMaxValueValidator, RangeMinValueValidator,
+)
from django.core import exceptions, serializers
from django.db import connection
from django.test import TestCase
from django.utils import timezone
-from psycopg2.extras import NumericRange, DateTimeTZRange, DateRange
-
from .models import RangesModel
diff --git a/tests/prefetch_related/models.py b/tests/prefetch_related/models.py
index 40540e9b26..9961fd15ae 100644
--- a/tests/prefetch_related/models.py
+++ b/tests/prefetch_related/models.py
@@ -1,5 +1,5 @@
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py
index d8d5c19f8e..f059a6f7ca 100644
--- a/tests/prefetch_related/tests.py
+++ b/tests/prefetch_related/tests.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
-from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType
+from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import Prefetch
from django.db.models.query import get_prefetcher
@@ -9,10 +9,12 @@ from django.test import TestCase, override_settings
from django.utils import six
from django.utils.encoding import force_text
-from .models import (Author, Bio, Book, Reader, Qualification, Teacher, Department,
- TaggedItem, Bookmark, AuthorAddress, FavoriteAuthors, AuthorWithAge,
- BookWithYear, BookReview, Person, House, Room, Employee, Comment,
- LessonEntry, WordEntry, Author2)
+from .models import (
+ Author, Author2, AuthorAddress, AuthorWithAge, Bio, Book, Bookmark,
+ BookReview, BookWithYear, Comment, Department, Employee, FavoriteAuthors,
+ House, LessonEntry, Person, Qualification, Reader, Room, TaggedItem,
+ Teacher, WordEntry,
+)
class PrefetchRelatedTests(TestCase):
diff --git a/tests/proxy_model_inheritance/tests.py b/tests/proxy_model_inheritance/tests.py
index 3678466e8c..b0af0040f9 100644
--- a/tests/proxy_model_inheritance/tests.py
+++ b/tests/proxy_model_inheritance/tests.py
@@ -7,8 +7,9 @@ from django.test import TestCase, TransactionTestCase
from django.test.utils import extend_sys_path
from django.utils._os import upath
-from .models import (ConcreteModel, ConcreteModelSubclass,
- ConcreteModelSubclassProxy)
+from .models import (
+ ConcreteModel, ConcreteModelSubclass, ConcreteModelSubclassProxy,
+)
class ProxyModelInheritanceTests(TransactionTestCase):
diff --git a/tests/proxy_models/admin.py b/tests/proxy_models/admin.py
index d2b6319301..72556c34a5 100644
--- a/tests/proxy_models/admin.py
+++ b/tests/proxy_models/admin.py
@@ -1,6 +1,6 @@
from django.contrib import admin
-from .models import TrackerUser, ProxyTrackerUser
+from .models import ProxyTrackerUser, TrackerUser
admin.site.register(TrackerUser)
admin.site.register(ProxyTrackerUser)
diff --git a/tests/proxy_models/models.py b/tests/proxy_models/models.py
index 2e28c3b996..90a542ffac 100644
--- a/tests/proxy_models/models.py
+++ b/tests/proxy_models/models.py
@@ -7,6 +7,7 @@ providing a modified interface to the data from the base class.
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
+
# A couple of managers for testing managing overriding in proxy model cases.
diff --git a/tests/proxy_models/tests.py b/tests/proxy_models/tests.py
index 131bd1524f..17d139bbeb 100644
--- a/tests/proxy_models/tests.py
+++ b/tests/proxy_models/tests.py
@@ -3,18 +3,18 @@ from __future__ import unicode_literals
from django.apps import apps
from django.contrib import admin
from django.contrib.contenttypes.models import ContentType
-from django.core import management
-from django.core import checks
-from django.db import models, DEFAULT_DB_ALIAS
+from django.core import checks, management
+from django.db import DEFAULT_DB_ALIAS, models
from django.db.models import signals
from django.test import TestCase, override_settings
-
-from .models import (MyPerson, Person, StatusPerson, LowerStatusPerson,
- MyPersonProxy, Abstract, OtherPerson, User, UserProxy, UserProxyProxy,
- Country, State, StateProxy, TrackerUser, BaseUser, Bug, ProxyTrackerUser,
- Improvement, ProxyProxyBug, ProxyBug, ProxyImprovement, Issue)
from .admin import admin as force_admin_model_registration # NOQA
+from .models import (
+ Abstract, BaseUser, Bug, Country, Improvement, Issue, LowerStatusPerson,
+ MyPerson, MyPersonProxy, OtherPerson, Person, ProxyBug, ProxyImprovement,
+ ProxyProxyBug, ProxyTrackerUser, State, StateProxy, StatusPerson,
+ TrackerUser, User, UserProxy, UserProxyProxy,
+)
class ProxyModelTests(TestCase):
diff --git a/tests/proxy_models/urls.py b/tests/proxy_models/urls.py
index 6fcf1e055b..eb91d283d4 100644
--- a/tests/proxy_models/urls.py
+++ b/tests/proxy_models/urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from django.contrib import admin
urlpatterns = [
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 8340369a6d..0f86a0f066 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -1,35 +1,37 @@
from __future__ import unicode_literals
-from collections import OrderedDict
import datetime
-from operator import attrgetter
import pickle
import unittest
+from collections import OrderedDict
+from operator import attrgetter
from django.core.exceptions import FieldError
-from django.db import connection, DEFAULT_DB_ALIAS
-from django.db.models import Count, F, Q
-from django.db.models.sql.where import WhereNode, NothingNode
+from django.db import DEFAULT_DB_ALIAS, connection
+from django.db.models import F, Q, Count
from django.db.models.sql.constants import LOUTER
from django.db.models.sql.datastructures import EmptyResultSet
+from django.db.models.sql.where import NothingNode, WhereNode
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import CaptureQueriesContext
from django.utils import six
from django.utils.six.moves import range
from .models import (
- Annotation, Article, Author, Celebrity, Child, Cover, Detail, DumbCategory,
- ExtraInfo, Fan, Item, LeafA, Join, LeafB, LoopX, LoopZ, ManagedModel,
- Member, NamedCategory, Note, Number, Plaything, PointerA, Ranking, Related,
- Report, ReservedName, Tag, TvChef, Valid, X, Food, Eaten, Node, ObjectA,
- ProxyObjectA, ChildObjectA, ObjectB, ProxyObjectB, ObjectC, CategoryItem,
- SimpleCategory, SpecialCategory, OneToOneCategory, NullableName, ProxyCategory,
- SingleObject, RelatedObject, ModelA, ModelB, ModelC, ModelD, Responsibility, Job,
- JobResponsibilities, BaseA, FK1, Identifier, Program, Channel, Page, Paragraph,
- Chapter, Book, MyObject, Order, OrderItem, SharedConnection, Task, Staff,
- StaffUser, CategoryRelationship, Ticket21203Parent, Ticket21203Child, Person,
- Company, Employment, CustomPk, CustomPkTag, Classroom, School, Student,
- Ticket23605A, Ticket23605B, Ticket23605C)
+ FK1, X, Annotation, Article, Author, BaseA, Book, CategoryItem,
+ CategoryRelationship, Celebrity, Channel, Chapter, Child, ChildObjectA,
+ Classroom, Company, Cover, CustomPk, CustomPkTag, Detail, DumbCategory,
+ Eaten, Employment, ExtraInfo, Fan, Food, Identifier, Item, Job,
+ JobResponsibilities, Join, LeafA, LeafB, LoopX, LoopZ, ManagedModel,
+ Member, ModelA, ModelB, ModelC, ModelD, MyObject, NamedCategory, Node,
+ Note, NullableName, Number, ObjectA, ObjectB, ObjectC, OneToOneCategory,
+ Order, OrderItem, Page, Paragraph, Person, Plaything, PointerA, Program,
+ ProxyCategory, ProxyObjectA, ProxyObjectB, Ranking, Related, RelatedObject,
+ Report, ReservedName, Responsibility, School, SharedConnection,
+ SimpleCategory, SingleObject, SpecialCategory, Staff, StaffUser, Student,
+ Tag, Task, Ticket21203Child, Ticket21203Parent, Ticket23605A, Ticket23605B,
+ Ticket23605C, TvChef, Valid,
+)
class BaseQuerysetTest(TestCase):
diff --git a/tests/queryset_pickle/models.py b/tests/queryset_pickle/models.py
index 792369c575..6503d1f33a 100644
--- a/tests/queryset_pickle/models.py
+++ b/tests/queryset_pickle/models.py
@@ -1,6 +1,6 @@
import datetime
-from django.db import models, DJANGO_VERSION_PICKLE_KEY
+from django.db import DJANGO_VERSION_PICKLE_KEY, models
from django.utils.translation import ugettext_lazy as _
from django.utils.version import get_major_version
diff --git a/tests/queryset_pickle/tests.py b/tests/queryset_pickle/tests.py
index c56b7179d2..a710a394d4 100644
--- a/tests/queryset_pickle/tests.py
+++ b/tests/queryset_pickle/tests.py
@@ -1,14 +1,14 @@
from __future__ import unicode_literals
-import pickle
import datetime
+import pickle
import warnings
from django.test import TestCase
from django.utils.encoding import force_text
from django.utils.version import get_major_version, get_version
-from .models import Group, Event, Happening, Container, M2MModel
+from .models import Container, Event, Group, Happening, M2MModel
class PickleabilityTestCase(TestCase):
diff --git a/tests/raw_query/tests.py b/tests/raw_query/tests.py
index 287b0f24dd..5d2bf4becf 100644
--- a/tests/raw_query/tests.py
+++ b/tests/raw_query/tests.py
@@ -5,7 +5,7 @@ from datetime import date
from django.db.models.query_utils import InvalidQuery
from django.test import TestCase, skipUnlessDBFeature
-from .models import Author, Book, Coffee, Reviewer, FriendlyAuthor
+from .models import Author, Book, Coffee, FriendlyAuthor, Reviewer
class RawQueryTests(TestCase):
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index e9fdefb7ea..b0598b1cc0 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -1,16 +1,18 @@
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
+import time
from datetime import datetime, timedelta
from io import BytesIO
from itertools import chain
-import time
from django.core.exceptions import SuspiciousOperation
-from django.core.handlers.wsgi import WSGIRequest, LimitedStream
-from django.http import (HttpRequest, HttpResponse, parse_cookie,
- build_request_repr, UnreadablePostError, RawPostDataException)
-from django.test import SimpleTestCase, RequestFactory, override_settings
+from django.core.handlers.wsgi import LimitedStream, WSGIRequest
+from django.http import (
+ HttpRequest, HttpResponse, RawPostDataException, UnreadablePostError,
+ build_request_repr, parse_cookie,
+)
+from django.test import RequestFactory, SimpleTestCase, override_settings
from django.test.client import FakePayload
from django.test.utils import str_prefix
from django.utils import six
diff --git a/tests/resolve_url/tests.py b/tests/resolve_url/tests.py
index 0fc3307026..b8ccd530e1 100644
--- a/tests/resolve_url/tests.py
+++ b/tests/resolve_url/tests.py
@@ -1,11 +1,11 @@
from __future__ import unicode_literals
-from django.core.urlresolvers import NoReverseMatch, reverse_lazy
from django.contrib.auth.views import logout
+from django.core.urlresolvers import NoReverseMatch, reverse_lazy
from django.shortcuts import resolve_url
from django.test import TestCase, ignore_warnings, override_settings
-from django.utils.deprecation import RemovedInDjango20Warning
from django.utils import six
+from django.utils.deprecation import RemovedInDjango20Warning
from .models import UnimportantThing
diff --git a/tests/reverse_lookup/tests.py b/tests/reverse_lookup/tests.py
index a1b33b26fa..1b9184d682 100644
--- a/tests/reverse_lookup/tests.py
+++ b/tests/reverse_lookup/tests.py
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from django.core.exceptions import FieldError
from django.test import TestCase
-from .models import User, Poll, Choice
+from .models import Choice, Poll, User
class ReverseLookupTests(TestCase):
diff --git a/tests/runtests.py b/tests/runtests.py
index cd84deb40e..0469d83600 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-from argparse import ArgumentParser
import logging
import os
import shutil
@@ -7,18 +6,20 @@ import subprocess
import sys
import tempfile
import warnings
+from argparse import ArgumentParser
import django
from django import contrib
from django.apps import apps
from django.conf import settings
from django.db import connection
-from django.test import TransactionTestCase, TestCase
+from django.test import TestCase, TransactionTestCase
from django.test.utils import get_runner
-from django.utils.deprecation import RemovedInDjango20Warning, RemovedInDjango21Warning
-from django.utils._os import upath
from django.utils import six
-
+from django.utils._os import upath
+from django.utils.deprecation import (
+ RemovedInDjango20Warning, RemovedInDjango21Warning,
+)
warnings.simplefilter("error", RemovedInDjango20Warning)
warnings.simplefilter("error", RemovedInDjango21Warning)
diff --git a/tests/schema/fields.py b/tests/schema/fields.py
index d4302a6677..4cba35ebf8 100644
--- a/tests/schema/fields.py
+++ b/tests/schema/fields.py
@@ -1,9 +1,8 @@
from django.db.models.fields.related import (
+ RECURSIVE_RELATIONSHIP_CONSTANT, ManyToManyField, ManyToManyRel,
+ RelatedField, ReverseManyRelatedObjectsDescriptor,
create_many_to_many_intermediary_model,
- ManyToManyField, ManyToManyRel, RelatedField,
- RECURSIVE_RELATIONSHIP_CONSTANT, ReverseManyRelatedObjectsDescriptor,
)
-
from django.utils.functional import curry
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index 9cda278be1..88b1a8db5b 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -2,11 +2,17 @@ import datetime
import itertools
import unittest
-from django.db import connection, DatabaseError, IntegrityError, OperationalError
+from django.db import (
+ DatabaseError, IntegrityError, OperationalError, connection,
+)
from django.db.models import Model
-from django.db.models.fields import (BinaryField, BooleanField, CharField, DateTimeField,
- IntegerField, PositiveIntegerField, SlugField, TextField)
-from django.db.models.fields.related import ForeignKey, ManyToManyField, OneToOneField
+from django.db.models.fields import (
+ BinaryField, BooleanField, CharField, DateTimeField, IntegerField,
+ PositiveIntegerField, SlugField, TextField,
+)
+from django.db.models.fields.related import (
+ ForeignKey, ManyToManyField, OneToOneField,
+)
from django.db.transaction import atomic
from django.test import TransactionTestCase
@@ -14,7 +20,7 @@ from .fields import CustomManyToManyField, InheritedManyToManyField
from .models import (
Author, AuthorWithDefaultHeight, AuthorWithEvenLongerName, Book, BookWeak,
BookWithLongName, BookWithO2O, BookWithSlug, Note, Tag, TagIndexed,
- TagM2MTest, TagUniqueRename, Thing, UniqueTest, new_apps
+ TagM2MTest, TagUniqueRename, Thing, UniqueTest, new_apps,
)
diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py
index abd7bd2ed4..af408f8ffe 100644
--- a/tests/select_for_update/tests.py
+++ b/tests/select_for_update/tests.py
@@ -3,16 +3,16 @@ from __future__ import unicode_literals
import threading
import time
+from multiple_database.routers import TestRouter
+
from django.conf import settings
-from django.db import transaction, connection, router
-from django.db.utils import ConnectionHandler, DEFAULT_DB_ALIAS, DatabaseError
+from django.db import connection, router, transaction
+from django.db.utils import DEFAULT_DB_ALIAS, ConnectionHandler, DatabaseError
from django.test import (
TransactionTestCase, override_settings, skipIfDBFeature,
skipUnlessDBFeature,
)
-from multiple_database.routers import TestRouter
-
from .models import Person
diff --git a/tests/select_related/models.py b/tests/select_related/models.py
index 96aace6a48..04aeaa1b61 100644
--- a/tests/select_related/models.py
+++ b/tests/select_related/models.py
@@ -7,11 +7,13 @@ isn't always a good idea, so the ``depth`` argument control how many "levels"
the select-related behavior will traverse.
"""
+from django.contrib.contenttypes.fields import (
+ GenericForeignKey, GenericRelation,
+)
+from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
-from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
-from django.contrib.contenttypes.models import ContentType
# Who remembers high school biology?
diff --git a/tests/select_related/tests.py b/tests/select_related/tests.py
index 378c0bf992..667ac2f00b 100644
--- a/tests/select_related/tests.py
+++ b/tests/select_related/tests.py
@@ -1,11 +1,11 @@
from __future__ import unicode_literals
-from django.test import TestCase
from django.core.exceptions import FieldError
+from django.test import TestCase
from .models import (
- Domain, Kingdom, Phylum, Klass, Order, Family, Genus, Species, HybridSpecies,
- Pizza, TaggedItem, Bookmark,
+ Bookmark, Domain, Family, Genus, HybridSpecies, Kingdom, Klass, Order,
+ Phylum, Pizza, Species, TaggedItem,
)
diff --git a/tests/select_related_onetoone/tests.py b/tests/select_related_onetoone/tests.py
index a6c0f3a42b..2cb17a5ba9 100644
--- a/tests/select_related_onetoone/tests.py
+++ b/tests/select_related_onetoone/tests.py
@@ -5,9 +5,10 @@ import unittest
from django.core.exceptions import FieldError
from django.test import TestCase
-from .models import (User, UserProfile, UserStat, UserStatResult, StatDetails,
- AdvancedUserStat, Image, Product, Parent1, Parent2, Child1, Child2, Child3,
- Child4)
+from .models import (
+ AdvancedUserStat, Child1, Child2, Child3, Child4, Image, Parent1, Parent2,
+ Product, StatDetails, User, UserProfile, UserStat, UserStatResult,
+)
class ReverseSelectRelatedTestCase(TestCase):
diff --git a/tests/select_related_regress/tests.py b/tests/select_related_regress/tests.py
index 6ee48e9aec..d014123beb 100644
--- a/tests/select_related_regress/tests.py
+++ b/tests/select_related_regress/tests.py
@@ -3,9 +3,11 @@ from __future__ import unicode_literals
from django.test import TestCase
from django.utils import six
-from .models import (Building, Child, Device, Port, Item, Country, Connection,
- ClientStatus, State, Client, SpecialClient, TUser, Person, Student,
- Organizer, Class, Enrollment, Hen, Chick, A, B, C)
+from .models import (
+ A, B, C, Building, Chick, Child, Class, Client, ClientStatus, Connection,
+ Country, Device, Enrollment, Hen, Item, Organizer, Person, Port,
+ SpecialClient, State, Student, TUser,
+)
class SelectRelatedRegressTests(TestCase):
diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py
index f6b66a054a..5448b01b29 100644
--- a/tests/serializers/tests.py
+++ b/tests/serializers/tests.py
@@ -3,26 +3,30 @@ from __future__ import unicode_literals
import importlib
import json
-from datetime import datetime
import re
import unittest
+from datetime import datetime
from xml.dom import minidom
-try:
- import yaml
- HAS_YAML = True
-except ImportError:
- HAS_YAML = False
-
from django.core import management, serializers
-from django.db import transaction, connection
-from django.test import TestCase, TransactionTestCase, override_settings, skipUnlessDBFeature
+from django.db import connection, transaction
+from django.test import (
+ TestCase, TransactionTestCase, override_settings, skipUnlessDBFeature,
+)
from django.test.utils import Approximate
from django.utils import six
from django.utils.six import StringIO
-from .models import (Category, Author, Article, AuthorProfile, Actor, Movie,
- Score, Player, Team)
+from .models import (
+ Actor, Article, Author, AuthorProfile, Category, Movie, Player, Score,
+ Team,
+)
+
+try:
+ import yaml
+ HAS_YAML = True
+except ImportError:
+ HAS_YAML = False
@override_settings(
diff --git a/tests/serializers_regress/models.py b/tests/serializers_regress/models.py
index 7c7b9f12b0..35c4e10676 100644
--- a/tests/serializers_regress/models.py
+++ b/tests/serializers_regress/models.py
@@ -4,11 +4,12 @@ A test spanning all the capabilities of all the serializers.
This class sets up a model for each model field type
(except for image types, because of the Pillow dependency).
"""
-from django.db import models
from django.contrib.contenttypes.fields import (
- GenericForeignKey, GenericRelation
+ GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
+from django.db import models
+
# The following classes are for testing basic data
# marshalling, including NULL values, where allowed.
diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py
index e91a1094ee..1bd8469641 100644
--- a/tests/serializers_regress/tests.py
+++ b/tests/serializers_regress/tests.py
@@ -12,35 +12,35 @@ import datetime
import decimal
from unittest import skipUnless
-try:
- import yaml
-except ImportError:
- yaml = None
-
from django.core import serializers
from django.core.serializers import SerializerDoesNotExist
from django.core.serializers.base import DeserializationError
from django.core.serializers.xml_serializer import DTDForbidden
from django.db import connection, models
from django.http import HttpResponse
-from django.test import skipUnlessDBFeature, TestCase
+from django.test import TestCase, skipUnlessDBFeature
from django.utils import six
from django.utils.functional import curry
-from .models import (BinaryData, BooleanData, CharData, DateData, DateTimeData, EmailData,
- FileData, FilePathData, DecimalData, FloatData, IntegerData,
- GenericIPAddressData, NullBooleanData, PositiveIntegerData,
- PositiveSmallIntegerData, SlugData, SmallData, TextData, TimeData,
- GenericData, Anchor, UniqueAnchor, FKData, M2MData, O2OData,
- FKSelfData, M2MSelfData, FKDataToField, FKDataToO2O, M2MIntermediateData,
- Intermediate, BooleanPKData, CharPKData, EmailPKData, FilePathPKData,
- DecimalPKData, FloatPKData, IntegerPKData,
- GenericIPAddressPKData, PositiveIntegerPKData,
- PositiveSmallIntegerPKData, SlugPKData, SmallPKData,
- AutoNowDateTimeData, ModifyingSaveData, InheritAbstractModel, BaseModel,
- ExplicitInheritBaseModel, InheritBaseModel, ProxyBaseModel,
- ProxyProxyBaseModel, BigIntegerData, LengthModel, Tag, ComplexModel,
- NaturalKeyAnchor, FKDataNaturalKey)
+from .models import (
+ Anchor, AutoNowDateTimeData, BaseModel, BigIntegerData, BinaryData,
+ BooleanData, BooleanPKData, CharData, CharPKData, ComplexModel, DateData,
+ DateTimeData, DecimalData, DecimalPKData, EmailData, EmailPKData,
+ ExplicitInheritBaseModel, FileData, FilePathData, FilePathPKData, FKData,
+ FKDataNaturalKey, FKDataToField, FKDataToO2O, FKSelfData, FloatData,
+ FloatPKData, GenericData, GenericIPAddressData, GenericIPAddressPKData,
+ InheritAbstractModel, InheritBaseModel, IntegerData, IntegerPKData,
+ Intermediate, LengthModel, M2MData, M2MIntermediateData, M2MSelfData,
+ ModifyingSaveData, NaturalKeyAnchor, NullBooleanData, O2OData,
+ PositiveIntegerData, PositiveIntegerPKData, PositiveSmallIntegerData,
+ PositiveSmallIntegerPKData, ProxyBaseModel, ProxyProxyBaseModel, SlugData,
+ SlugPKData, SmallData, SmallPKData, Tag, TextData, TimeData, UniqueAnchor,
+)
+
+try:
+ import yaml
+except ImportError:
+ yaml = None
# A set of functions that can be used to recreate
# test data objects of various kinds.
diff --git a/tests/servers/tests.py b/tests/servers/tests.py
index 50b2cafe1a..e84b8788c0 100644
--- a/tests/servers/tests.py
+++ b/tests/servers/tests.py
@@ -8,16 +8,14 @@ import os
import socket
from django.core.exceptions import ImproperlyConfigured
-from django.test import LiveServerTestCase
-from django.test import override_settings
+from django.test import LiveServerTestCase, override_settings
+from django.utils._os import upath
from django.utils.http import urlencode
from django.utils.six.moves.urllib.error import HTTPError
from django.utils.six.moves.urllib.request import urlopen
-from django.utils._os import upath
from .models import Person
-
TEST_ROOT = os.path.dirname(upath(__file__))
TEST_SETTINGS = {
'MEDIA_URL': '/media/',
diff --git a/tests/servers/urls.py b/tests/servers/urls.py
index 002e604105..868ecc34f9 100644
--- a/tests/servers/urls.py
+++ b/tests/servers/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from . import views
-
urlpatterns = [
url(r'^example_view/$', views.example_view),
url(r'^model_view/$', views.model_view),
diff --git a/tests/servers/views.py b/tests/servers/views.py
index eb7c6c650d..f1fb8714c5 100644
--- a/tests/servers/views.py
+++ b/tests/servers/views.py
@@ -1,4 +1,5 @@
from django.http import HttpResponse
+
from .models import Person
diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py
index 8d39d6c1b1..6a444d56a9 100644
--- a/tests/settings_tests/tests.py
+++ b/tests/settings_tests/tests.py
@@ -1,14 +1,16 @@
import os
import sys
-from types import ModuleType
import unittest
import warnings
+from types import ModuleType
from django.conf import LazySettings, Settings, settings
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest
-from django.test import (SimpleTestCase, TransactionTestCase, TestCase,
- modify_settings, override_settings, signals)
+from django.test import (
+ SimpleTestCase, TestCase, TransactionTestCase, modify_settings,
+ override_settings, signals,
+)
from django.utils import six
from django.utils.encoding import force_text
diff --git a/tests/shortcuts/tests.py b/tests/shortcuts/tests.py
index 98251244c5..08bcc55343 100644
--- a/tests/shortcuts/tests.py
+++ b/tests/shortcuts/tests.py
@@ -1,6 +1,6 @@
-from django.utils.deprecation import RemovedInDjango20Warning
from django.test import TestCase, ignore_warnings, override_settings
from django.test.utils import require_jinja2
+from django.utils.deprecation import RemovedInDjango20Warning
@override_settings(
diff --git a/tests/shortcuts/views.py b/tests/shortcuts/views.py
index 85d1922d58..f988edf8d9 100644
--- a/tests/shortcuts/views.py
+++ b/tests/shortcuts/views.py
@@ -1,10 +1,9 @@
import os.path
-from django.shortcuts import render_to_response, render
+from django.shortcuts import render, render_to_response
from django.template import Context, RequestContext
from django.utils._os import upath
-
dirs = (os.path.join(os.path.dirname(upath(__file__)), 'other_templates'),)
diff --git a/tests/signing/tests.py b/tests/signing/tests.py
index 32b8bb3b5e..006151baf6 100644
--- a/tests/signing/tests.py
+++ b/tests/signing/tests.py
@@ -5,8 +5,8 @@ import datetime
from django.core import signing
from django.test import TestCase
from django.test.utils import freeze_time
-from django.utils.encoding import force_str
from django.utils import six
+from django.utils.encoding import force_str
class TestSigner(TestCase):
diff --git a/tests/sites_framework/migrations/0001_initial.py b/tests/sites_framework/migrations/0001_initial.py
index 2ce80fd87d..5a4ac27961 100644
--- a/tests/sites_framework/migrations/0001_initial.py
+++ b/tests/sites_framework/migrations/0001_initial.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from django.db import models, migrations
+from django.db import migrations, models
class Migration(migrations.Migration):
diff --git a/tests/sites_framework/tests.py b/tests/sites_framework/tests.py
index 97d01e1d57..911286adc1 100644
--- a/tests/sites_framework/tests.py
+++ b/tests/sites_framework/tests.py
@@ -6,8 +6,9 @@ from django.core import checks
from django.db import models
from django.test import TestCase
-from .models import (SyndicatedArticle, ExclusiveArticle, CustomArticle,
- AbstractArticle)
+from .models import (
+ AbstractArticle, CustomArticle, ExclusiveArticle, SyndicatedArticle,
+)
class SitesFrameworkTestCase(TestCase):
diff --git a/tests/staticfiles_tests/storage.py b/tests/staticfiles_tests/storage.py
index e47af18b22..fe4811a495 100644
--- a/tests/staticfiles_tests/storage.py
+++ b/tests/staticfiles_tests/storage.py
@@ -1,6 +1,7 @@
from datetime import datetime
-from django.core.files import storage
+
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
+from django.core.files import storage
class DummyStorage(storage.Storage):
diff --git a/tests/staticfiles_tests/test_liveserver.py b/tests/staticfiles_tests/test_liveserver.py
index 4038797264..58b96b69ec 100644
--- a/tests/staticfiles_tests/test_liveserver.py
+++ b/tests/staticfiles_tests/test_liveserver.py
@@ -6,13 +6,11 @@ django.test.LiveServerTestCase.
import os
+from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.exceptions import ImproperlyConfigured
from django.test import modify_settings, override_settings
-from django.utils.six.moves.urllib.request import urlopen
from django.utils._os import upath
-
-from django.contrib.staticfiles.testing import StaticLiveServerTestCase
-
+from django.utils.six.moves.urllib.request import urlopen
TEST_ROOT = os.path.dirname(upath(__file__))
TEST_SETTINGS = {
diff --git a/tests/staticfiles_tests/tests.py b/tests/staticfiles_tests/tests.py
index 7715b23f7b..e79d32dbf7 100644
--- a/tests/staticfiles_tests/tests.py
+++ b/tests/staticfiles_tests/tests.py
@@ -9,23 +9,23 @@ import sys
import tempfile
import unittest
-from django.template import Context, Template
from django.conf import settings
+from django.contrib.staticfiles import finders, storage
+from django.contrib.staticfiles.management.commands import collectstatic
+from django.contrib.staticfiles.management.commands.collectstatic import \
+ Command as CollectstaticCommand
from django.core.cache.backends.base import BaseCache
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
+from django.template import Context, Template
from django.test import TestCase, override_settings
+from django.utils import six
+from django.utils._os import rmtree_errorhandler, symlinks_supported, upath
from django.utils.encoding import force_text
from django.utils.functional import empty
-from django.utils._os import rmtree_errorhandler, upath, symlinks_supported
-from django.utils import six
-
-from django.contrib.staticfiles import finders, storage
-from django.contrib.staticfiles.management.commands import collectstatic
from .storage import DummyStorage
-
TEST_ROOT = os.path.dirname(upath(__file__))
TEST_SETTINGS = {
'DEBUG': True,
@@ -52,7 +52,6 @@ TEST_SETTINGS = {
'staticfiles_tests.apps.no_label',
],
}
-from django.contrib.staticfiles.management.commands.collectstatic import Command as CollectstaticCommand
class BaseStaticFilesTestCase(object):
diff --git a/tests/string_lookup/tests.py b/tests/string_lookup/tests.py
index 5a17e55560..13a4544604 100644
--- a/tests/string_lookup/tests.py
+++ b/tests/string_lookup/tests.py
@@ -2,7 +2,8 @@
from __future__ import unicode_literals
from django.test import TestCase
-from .models import Foo, Whiz, Bar, Article, Base, Child
+
+from .models import Article, Bar, Base, Child, Foo, Whiz
class StringLookupTests(TestCase):
diff --git a/tests/swappable_models/tests.py b/tests/swappable_models/tests.py
index 246d456f20..9ba684170c 100644
--- a/tests/swappable_models/tests.py
+++ b/tests/swappable_models/tests.py
@@ -1,13 +1,12 @@
from __future__ import unicode_literals
-from django.utils.six import StringIO
+from swappable_models.models import Article
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.test import TestCase, override_settings
-
-from swappable_models.models import Article
+from django.utils.six import StringIO
class SwappableModelTests(TestCase):
diff --git a/tests/syndication_tests/tests.py b/tests/syndication_tests/tests.py
index 63638fa589..6e08d719d4 100644
--- a/tests/syndication_tests/tests.py
+++ b/tests/syndication_tests/tests.py
@@ -3,21 +3,20 @@ from __future__ import unicode_literals
import datetime
from xml.dom import minidom
-try:
- import pytz
-except ImportError:
- pytz = None
-
from django.contrib.sites.models import Site
from django.contrib.syndication import views
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings
from django.test.utils import requires_tz_support
-from django.utils.feedgenerator import rfc2822_date, rfc3339_date
from django.utils import timezone
+from django.utils.feedgenerator import rfc2822_date, rfc3339_date
from .models import Entry
+try:
+ import pytz
+except ImportError:
+ pytz = None
TZ = timezone.get_default_timezone()
diff --git a/tests/syndication_tests/urls.py b/tests/syndication_tests/urls.py
index f92896f308..d3caeae888 100644
--- a/tests/syndication_tests/urls.py
+++ b/tests/syndication_tests/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from . import feeds
-
urlpatterns = [
url(r'^syndication/rss2/$', feeds.TestRss2Feed()),
url(r'^syndication/rss2/guid_ispermalink_true/$',
diff --git a/tests/template_backends/test_django.py b/tests/template_backends/test_django.py
index 2aaf6b57d8..a8cc0d58b8 100644
--- a/tests/template_backends/test_django.py
+++ b/tests/template_backends/test_django.py
@@ -1,10 +1,10 @@
+from template_tests.test_response import test_processor_name
+
from django.template import RequestContext
from django.template.backends.django import DjangoTemplates
-from django.test import ignore_warnings, RequestFactory
+from django.test import RequestFactory, ignore_warnings
from django.utils.deprecation import RemovedInDjango20Warning
-from template_tests.test_response import test_processor_name
-
from .test_dummy import TemplateStringsTests
diff --git a/tests/template_backends/test_jinja2.py b/tests/template_backends/test_jinja2.py
index 1442f25e02..5f69669446 100644
--- a/tests/template_backends/test_jinja2.py
+++ b/tests/template_backends/test_jinja2.py
@@ -4,6 +4,8 @@ from __future__ import absolute_import
from unittest import skipIf
+from .test_dummy import TemplateStringsTests
+
try:
import jinja2
except ImportError:
@@ -12,8 +14,6 @@ except ImportError:
else:
from django.template.backends.jinja2 import Jinja2
-from .test_dummy import TemplateStringsTests
-
@skipIf(jinja2 is None, "this test requires jinja2")
class Jinja2Tests(TemplateStringsTests):
diff --git a/tests/template_loader/tests.py b/tests/template_loader/tests.py
index 12bfa1b543..a4a4542f32 100644
--- a/tests/template_loader/tests.py
+++ b/tests/template_loader/tests.py
@@ -1,8 +1,9 @@
-from django.test import override_settings, SimpleTestCase
-from django.test.client import RequestFactory
from django.template import TemplateDoesNotExist
from django.template.loader import (
- get_template, select_template, render_to_string)
+ get_template, render_to_string, select_template,
+)
+from django.test import SimpleTestCase, override_settings
+from django.test.client import RequestFactory
@override_settings(TEMPLATES=[{
diff --git a/tests/template_tests/alternate_urls.py b/tests/template_tests/alternate_urls.py
index 9b05aa619b..cb73513879 100644
--- a/tests/template_tests/alternate_urls.py
+++ b/tests/template_tests/alternate_urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from . import views
-
urlpatterns = [
# View returning a template response
url(r'^template_response_view/$', views.template_response_view),
diff --git a/tests/template_tests/filter_tests/test_autoescape.py b/tests/template_tests/filter_tests/test_autoescape.py
index 793fbf80d6..35faada9c6 100644
--- a/tests/template_tests/filter_tests/test_autoescape.py
+++ b/tests/template_tests/filter_tests/test_autoescape.py
@@ -1,6 +1,6 @@
from django.test import SimpleTestCase
-from ..utils import setup, SafeClass, UnsafeClass
+from ..utils import SafeClass, UnsafeClass, setup
class AutoescapeStringfilterTests(SimpleTestCase):
diff --git a/tests/template_tests/filter_tests/test_date.py b/tests/template_tests/filter_tests/test_date.py
index 8485e10a19..612742a501 100644
--- a/tests/template_tests/filter_tests/test_date.py
+++ b/tests/template_tests/filter_tests/test_date.py
@@ -4,8 +4,8 @@ from django.template.defaultfilters import date
from django.test import SimpleTestCase
from django.utils import timezone
-from .timezone_utils import TimezoneTestCase
from ..utils import setup
+from .timezone_utils import TimezoneTestCase
class DateTests(TimezoneTestCase):
diff --git a/tests/template_tests/filter_tests/test_time.py b/tests/template_tests/filter_tests/test_time.py
index e2b47b45b4..f5dc47813e 100644
--- a/tests/template_tests/filter_tests/test_time.py
+++ b/tests/template_tests/filter_tests/test_time.py
@@ -4,8 +4,8 @@ from django.template.defaultfilters import time as time_filter
from django.test import SimpleTestCase
from django.utils import timezone
-from .timezone_utils import TimezoneTestCase
from ..utils import setup
+from .timezone_utils import TimezoneTestCase
class TimeTests(TimezoneTestCase):
diff --git a/tests/template_tests/filter_tests/test_timesince.py b/tests/template_tests/filter_tests/test_timesince.py
index e10e86e921..52901cea36 100644
--- a/tests/template_tests/filter_tests/test_timesince.py
+++ b/tests/template_tests/filter_tests/test_timesince.py
@@ -6,8 +6,8 @@ from django.template.defaultfilters import timesince_filter
from django.test import SimpleTestCase
from django.test.utils import requires_tz_support
-from .timezone_utils import TimezoneTestCase
from ..utils import setup
+from .timezone_utils import TimezoneTestCase
class TimesinceTests(TimezoneTestCase):
diff --git a/tests/template_tests/filter_tests/test_timeuntil.py b/tests/template_tests/filter_tests/test_timeuntil.py
index 822a7ea9eb..5befabb379 100644
--- a/tests/template_tests/filter_tests/test_timeuntil.py
+++ b/tests/template_tests/filter_tests/test_timeuntil.py
@@ -6,8 +6,8 @@ from django.template.defaultfilters import timeuntil_filter
from django.test import SimpleTestCase
from django.test.utils import requires_tz_support
-from .timezone_utils import TimezoneTestCase
from ..utils import setup
+from .timezone_utils import TimezoneTestCase
class TimeuntilTests(TimezoneTestCase):
diff --git a/tests/template_tests/syntax_tests/test_autoescape.py b/tests/template_tests/syntax_tests/test_autoescape.py
index 7b5c12c59c..d58dfc9176 100644
--- a/tests/template_tests/syntax_tests/test_autoescape.py
+++ b/tests/template_tests/syntax_tests/test_autoescape.py
@@ -2,7 +2,7 @@ from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
-from ..utils import setup, SafeClass, UnsafeClass
+from ..utils import SafeClass, UnsafeClass, setup
class AutoescapeTagTests(SimpleTestCase):
diff --git a/tests/template_tests/syntax_tests/test_basic.py b/tests/template_tests/syntax_tests/test_basic.py
index 073d26e10b..741b3ace8f 100644
--- a/tests/template_tests/syntax_tests/test_basic.py
+++ b/tests/template_tests/syntax_tests/test_basic.py
@@ -1,8 +1,7 @@
from django.template.base import Context, TemplateSyntaxError
from django.test import SimpleTestCase
-from ..utils import setup, SilentGetItemClass, SilentAttrClass, SomeClass
-
+from ..utils import SilentAttrClass, SilentGetItemClass, SomeClass, setup
basic_templates = {
'basic-syntax01': 'something cool',
diff --git a/tests/template_tests/syntax_tests/test_exceptions.py b/tests/template_tests/syntax_tests/test_exceptions.py
index e3645cb13f..db1e0f9f5f 100644
--- a/tests/template_tests/syntax_tests/test_exceptions.py
+++ b/tests/template_tests/syntax_tests/test_exceptions.py
@@ -1,8 +1,8 @@
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.test import SimpleTestCase
-from .test_extends import inheritance_templates
from ..utils import setup
+from .test_extends import inheritance_templates
class ExceptionsTests(SimpleTestCase):
diff --git a/tests/template_tests/syntax_tests/test_extends.py b/tests/template_tests/syntax_tests/test_extends.py
index 3ad19616af..1b0ff36a3c 100644
--- a/tests/template_tests/syntax_tests/test_extends.py
+++ b/tests/template_tests/syntax_tests/test_extends.py
@@ -2,7 +2,6 @@ from django.test import SimpleTestCase
from ..utils import setup
-
inheritance_templates = {
'inheritance01': "1{% block first %}&{% endblock %}3{% block second %}_{% endblock %}",
'inheritance02': "{% extends 'inheritance01' %}"
diff --git a/tests/template_tests/syntax_tests/test_filter_syntax.py b/tests/template_tests/syntax_tests/test_filter_syntax.py
index 94e7fe2871..1793fc67de 100644
--- a/tests/template_tests/syntax_tests/test_filter_syntax.py
+++ b/tests/template_tests/syntax_tests/test_filter_syntax.py
@@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
-from ..utils import setup, SomeClass, SomeOtherException, UTF8Class
+from ..utils import SomeClass, SomeOtherException, UTF8Class, setup
class FilterSyntaxTests(SimpleTestCase):
diff --git a/tests/template_tests/syntax_tests/test_if.py b/tests/template_tests/syntax_tests/test_if.py
index 9f207c4114..290a092a04 100644
--- a/tests/template_tests/syntax_tests/test_if.py
+++ b/tests/template_tests/syntax_tests/test_if.py
@@ -1,11 +1,11 @@
import warnings
from django.template import TemplateSyntaxError
-from django.test import ignore_warnings, SimpleTestCase
+from django.test import SimpleTestCase, ignore_warnings
from django.test.utils import reset_warning_registry
from django.utils.deprecation import RemovedInDjango20Warning
-from ..utils import setup, TestObj
+from ..utils import TestObj, setup
class IfTagTests(SimpleTestCase):
diff --git a/tests/template_tests/syntax_tests/test_include.py b/tests/template_tests/syntax_tests/test_include.py
index 7f3adfd8fe..17ad9c1e4c 100644
--- a/tests/template_tests/syntax_tests/test_include.py
+++ b/tests/template_tests/syntax_tests/test_include.py
@@ -1,9 +1,8 @@
from django.template import Context, TemplateDoesNotExist, TemplateSyntaxError
from django.test import SimpleTestCase
-from .test_basic import basic_templates
from ..utils import setup
-
+from .test_basic import basic_templates
include_fail_templates = {
'include-fail1': '{% load bad_tag %}{% badtag %}',
diff --git a/tests/template_tests/syntax_tests/test_numpy.py b/tests/template_tests/syntax_tests/test_numpy.py
index dd6c01f976..822b10fd7a 100644
--- a/tests/template_tests/syntax_tests/test_numpy.py
+++ b/tests/template_tests/syntax_tests/test_numpy.py
@@ -1,5 +1,5 @@
-from unittest import skipIf
import warnings
+from unittest import skipIf
from django.test import SimpleTestCase
diff --git a/tests/template_tests/syntax_tests/test_ssi.py b/tests/template_tests/syntax_tests/test_ssi.py
index c971f5c32c..591e540edb 100644
--- a/tests/template_tests/syntax_tests/test_ssi.py
+++ b/tests/template_tests/syntax_tests/test_ssi.py
@@ -1,6 +1,6 @@
import os
-from django.test import ignore_warnings, SimpleTestCase
+from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango20Warning
from ..utils import ROOT, setup
diff --git a/tests/template_tests/syntax_tests/test_static.py b/tests/template_tests/syntax_tests/test_static.py
index 19b4e53cde..b646ac2bb8 100644
--- a/tests/template_tests/syntax_tests/test_static.py
+++ b/tests/template_tests/syntax_tests/test_static.py
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.test import override_settings, SimpleTestCase
+from django.test import SimpleTestCase, override_settings
from django.utils.six.moves.urllib.parse import urljoin
from ..utils import setup
diff --git a/tests/template_tests/syntax_tests/test_url.py b/tests/template_tests/syntax_tests/test_url.py
index 60f777f6d0..8da4dba67b 100644
--- a/tests/template_tests/syntax_tests/test_url.py
+++ b/tests/template_tests/syntax_tests/test_url.py
@@ -1,7 +1,7 @@
# coding: utf-8
from django.core.urlresolvers import NoReverseMatch
from django.template import TemplateSyntaxError
-from django.test import ignore_warnings, override_settings, SimpleTestCase
+from django.test import SimpleTestCase, ignore_warnings, override_settings
from django.utils.deprecation import RemovedInDjango20Warning
from ..utils import setup
diff --git a/tests/template_tests/templatetags/bad_tag.py b/tests/template_tests/templatetags/bad_tag.py
index b806423df3..a5be15633b 100644
--- a/tests/template_tests/templatetags/bad_tag.py
+++ b/tests/template_tests/templatetags/bad_tag.py
@@ -1,6 +1,5 @@
from django import template
-
register = template.Library()
diff --git a/tests/template_tests/templatetags/inclusion.py b/tests/template_tests/templatetags/inclusion.py
index e4edb264aa..77c9abeb5c 100644
--- a/tests/template_tests/templatetags/inclusion.py
+++ b/tests/template_tests/templatetags/inclusion.py
@@ -4,7 +4,6 @@ from django.template import Library
from django.template.loader import get_template
from django.utils import six
-
register = Library()
diff --git a/tests/template_tests/test_context.py b/tests/template_tests/test_context.py
index 24d589fb25..c7cd70ef6f 100644
--- a/tests/template_tests/test_context.py
+++ b/tests/template_tests/test_context.py
@@ -3,7 +3,9 @@
from unittest import TestCase
from django.http import HttpRequest
-from django.template import Context, RequestContext, Variable, VariableDoesNotExist
+from django.template import (
+ Context, RequestContext, Variable, VariableDoesNotExist,
+)
from django.template.context import RenderContext
diff --git a/tests/template_tests/test_loaders.py b/tests/template_tests/test_loaders.py
index 735dbac87a..bab4a469d9 100644
--- a/tests/template_tests/test_loaders.py
+++ b/tests/template_tests/test_loaders.py
@@ -9,22 +9,19 @@ import sys
import types
import unittest
-try:
- import pkg_resources
-except ImportError:
- pkg_resources = None
-
-
-from django.template import TemplateDoesNotExist, Context
-from django.template.loaders import cached, eggs
+from django.template import Context, TemplateDoesNotExist, loader
from django.template.engine import Engine
-from django.template import loader
+from django.template.loaders import cached, eggs
from django.test import SimpleTestCase, ignore_warnings, override_settings
from django.utils import six
-from django.utils.deprecation import RemovedInDjango20Warning
from django.utils._os import upath
+from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.six import StringIO
+try:
+ import pkg_resources
+except ImportError:
+ pkg_resources = None
TEMPLATES_DIR = os.path.join(os.path.dirname(upath(__file__)), 'templates')
diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py
index 348428513b..1e1d76b1bd 100644
--- a/tests/template_tests/test_parser.py
+++ b/tests/template_tests/test_parser.py
@@ -6,7 +6,9 @@ from __future__ import unicode_literals
from unittest import TestCase
from django.template import Library, Template, TemplateSyntaxError
-from django.template.base import FilterExpression, Parser, TokenParser, Variable
+from django.template.base import (
+ FilterExpression, Parser, TokenParser, Variable,
+)
from django.test import override_settings
from django.utils import six
diff --git a/tests/template_tests/test_response.py b/tests/template_tests/test_response.py
index 5c73265ded..eabaac6ce6 100644
--- a/tests/template_tests/test_response.py
+++ b/tests/template_tests/test_response.py
@@ -1,16 +1,18 @@
from __future__ import unicode_literals
-from datetime import datetime
import os
import pickle
import time
+from datetime import datetime
-from django.test import RequestFactory, SimpleTestCase
from django.conf import settings
from django.template import Context, engines
-from django.template.response import (TemplateResponse, SimpleTemplateResponse,
- ContentNotRenderedError)
-from django.test import ignore_warnings, override_settings
+from django.template.response import (
+ ContentNotRenderedError, SimpleTemplateResponse, TemplateResponse,
+)
+from django.test import (
+ RequestFactory, SimpleTestCase, ignore_warnings, override_settings,
+)
from django.test.utils import require_jinja2
from django.utils._os import upath
from django.utils.deprecation import RemovedInDjango20Warning
diff --git a/tests/template_tests/test_unicode.py b/tests/template_tests/test_unicode.py
index 02d3d0a51d..b692bfe31c 100644
--- a/tests/template_tests/test_unicode.py
+++ b/tests/template_tests/test_unicode.py
@@ -3,10 +3,10 @@ from __future__ import unicode_literals
from unittest import TestCase
-from django.template import Template, Context
+from django.template import Context, Template
from django.template.base import TemplateEncodingError
-from django.utils.safestring import SafeData
from django.utils import six
+from django.utils.safestring import SafeData
class UnicodeTests(TestCase):
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index 8b93039dca..c57c3d1479 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -8,15 +8,18 @@ import unittest
from django import template
from django.contrib.auth.models import Group
from django.core import urlresolvers
-from django.template import (base as template_base, loader,
- Context, RequestContext, Template, TemplateSyntaxError)
+from django.template import (
+ Context, RequestContext, Template, TemplateSyntaxError,
+ base as template_base, loader,
+)
from django.template.engine import Engine
from django.template.loaders import app_directories, filesystem
from django.test import RequestFactory, SimpleTestCase
-from django.test.utils import extend_sys_path, ignore_warnings, override_settings
-from django.utils.deprecation import RemovedInDjango20Warning
+from django.test.utils import (
+ extend_sys_path, ignore_warnings, override_settings,
+)
from django.utils._os import upath
-
+from django.utils.deprecation import RemovedInDjango20Warning
TESTS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(upath(__file__))))
diff --git a/tests/template_tests/urls.py b/tests/template_tests/urls.py
index 2ddb6e232c..858f6d19f6 100644
--- a/tests/template_tests/urls.py
+++ b/tests/template_tests/urls.py
@@ -2,8 +2,8 @@
from __future__ import unicode_literals
from django.conf.urls import url
-from . import views
+from . import views
urlpatterns = [
# Test urls for testing reverse lookups
diff --git a/tests/template_tests/utils.py b/tests/template_tests/utils.py
index 588c1a4096..d5af69bdd6 100644
--- a/tests/template_tests/utils.py
+++ b/tests/template_tests/utils.py
@@ -2,8 +2,8 @@
from __future__ import unicode_literals
-import os
import functools
+import os
from django import template
from django.template import Library
@@ -14,7 +14,6 @@ from django.utils._os import upath
from django.utils.encoding import python_2_unicode_compatible
from django.utils.safestring import mark_safe
-
ROOT = os.path.dirname(os.path.abspath(upath(__file__)))
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 7059c23a81..05de326bef 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -24,8 +24,7 @@ from __future__ import unicode_literals
from django.core import mail
from django.http import HttpResponse
-from django.test import Client, TestCase, RequestFactory
-from django.test import override_settings
+from django.test import Client, RequestFactory, TestCase, override_settings
from .views import get_view, post_view, trace_view
diff --git a/tests/test_client/urls.py b/tests/test_client/urls.py
index 72fe9676ee..1b7530db1c 100644
--- a/tests/test_client/urls.py
+++ b/tests/test_client/urls.py
@@ -4,7 +4,6 @@ from django.views.generic import RedirectView
from . import views
-
urlpatterns = [
url(r'^get_view/$', views.get_view, name='get_view'),
url(r'^post_view/$', views.post_view),
diff --git a/tests/test_client/views.py b/tests/test_client/views.py
index 2b7a4de63c..f26d474612 100644
--- a/tests/test_client/views.py
+++ b/tests/test_client/views.py
@@ -4,10 +4,10 @@ from django.contrib.auth.decorators import login_required, permission_required
from django.core import mail
from django.forms import fields
from django.forms.forms import Form, ValidationError
-from django.forms.formsets import formset_factory, BaseFormSet
+from django.forms.formsets import BaseFormSet, formset_factory
from django.http import (
- HttpResponse, HttpResponseRedirect, HttpResponseNotFound,
- HttpResponseNotAllowed, HttpResponseBadRequest,
+ HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed,
+ HttpResponseNotFound, HttpResponseRedirect,
)
from django.shortcuts import render_to_response
from django.template import Context, Template
diff --git a/tests/test_client_regress/models.py b/tests/test_client_regress/models.py
index b72d4480bf..aebc93c91b 100644
--- a/tests/test_client_regress/models.py
+++ b/tests/test_client_regress/models.py
@@ -1,5 +1,5 @@
-from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
+from django.db import models
class CustomUser(AbstractBaseUser):
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index c97ad550d1..fcceaf7346 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -4,21 +4,21 @@ Regression tests for the Test Client, especially the customized assertions.
"""
from __future__ import unicode_literals
-import os
import itertools
+import os
-from django.core.urlresolvers import reverse, NoReverseMatch
-from django.template import TemplateSyntaxError, Context, engines
+from django.contrib.auth.models import User
+from django.contrib.auth.signals import user_logged_in, user_logged_out
+from django.core.urlresolvers import NoReverseMatch, reverse
+from django.http import HttpResponse
+from django.template import Context, TemplateSyntaxError, engines
+from django.template.response import SimpleTemplateResponse
from django.test import Client, TestCase, ignore_warnings, override_settings
from django.test.client import RedirectCycleError, RequestFactory, encode_file
from django.test.utils import ContextList, str_prefix
-from django.template.response import SimpleTemplateResponse
-from django.utils.deprecation import RemovedInDjango20Warning
from django.utils._os import upath
+from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.translation import ugettext_lazy
-from django.http import HttpResponse
-from django.contrib.auth.signals import user_logged_out, user_logged_in
-from django.contrib.auth.models import User
from .models import CustomUser
from .views import CustomTestException
diff --git a/tests/test_client_regress/urls.py b/tests/test_client_regress/urls.py
index a69a774555..fd7c131797 100644
--- a/tests/test_client_regress/urls.py
+++ b/tests/test_client_regress/urls.py
@@ -1,9 +1,8 @@
-from django.conf.urls import url, include
+from django.conf.urls import include, url
from django.views.generic import RedirectView
from . import views
-
urlpatterns = [
url(r'', include('test_client.urls')),
diff --git a/tests/test_client_regress/views.py b/tests/test_client_regress/views.py
index 1c5e221a2a..6046564ee4 100644
--- a/tests/test_client_regress/views.py
+++ b/tests/test_client_regress/views.py
@@ -2,9 +2,9 @@ import json
from django.conf import settings
from django.contrib.auth.decorators import login_required
+from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
-from django.core.serializers.json import DjangoJSONEncoder
from django.template import RequestContext
from django.template.loader import render_to_string
from django.test import Client
diff --git a/tests/test_runner/test_discover_runner.py b/tests/test_runner/test_discover_runner.py
index ecf83f9f70..758f2d1198 100644
--- a/tests/test_runner/test_discover_runner.py
+++ b/tests/test_runner/test_discover_runner.py
@@ -1,5 +1,5 @@
-from contextlib import contextmanager
import os
+from contextlib import contextmanager
from unittest import TestSuite, TextTestRunner, defaultTestLoader
from django.test import TestCase
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py
index a8ce8d947c..d94d264321 100644
--- a/tests/test_runner/tests.py
+++ b/tests/test_runner/tests.py
@@ -5,17 +5,20 @@ from __future__ import unicode_literals
import unittest
+from admin_scripts.tests import AdminScriptTestCase
+
from django import db
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django.db.backends.dummy.base import DatabaseCreation
-from django.test import TestCase, TransactionTestCase, mock, skipUnlessDBFeature
+from django.test import (
+ TestCase, TransactionTestCase, mock, skipUnlessDBFeature,
+)
from django.test.runner import DiscoverRunner, dependency_ordered
from django.test.testcases import connections_support_transactions
from django.utils import six
-from admin_scripts.tests import AdminScriptTestCase
from .models import Person
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index 1deda66b2e..9c6861393a 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -4,7 +4,7 @@ from __future__ import unicode_literals
import unittest
from django.conf.urls import url
-from django.contrib.staticfiles.finders import get_finders, get_finder
+from django.contrib.staticfiles.finders import get_finder, get_finders
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.files.storage import default_storage
from django.core.urlresolvers import NoReverseMatch, reverse
@@ -12,7 +12,9 @@ from django.db import connection, router
from django.forms import EmailField, IntegerField
from django.http import HttpResponse
from django.template.loader import render_to_string
-from django.test import SimpleTestCase, TestCase, skipIfDBFeature, skipUnlessDBFeature
+from django.test import (
+ SimpleTestCase, TestCase, skipIfDBFeature, skipUnlessDBFeature,
+)
from django.test.html import HTMLParseError, parse_html
from django.test.utils import CaptureQueriesContext, override_settings
from django.utils import six
diff --git a/tests/test_utils/urls.py b/tests/test_utils/urls.py
index 4193cabf91..a886451721 100644
--- a/tests/test_utils/urls.py
+++ b/tests/test_utils/urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from . import views
-
urlpatterns = [
url(r'^test_utils/get_person/([0-9]+)/$', views.get_person),
url(r'^test_utils/no_template_used/$', views.no_template_used),
diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py
index a8ee433464..8534b9f8de 100644
--- a/tests/timezones/tests.py
+++ b/tests/timezones/tests.py
@@ -3,30 +3,35 @@ from __future__ import unicode_literals
import datetime
import re
import sys
-from unittest import skipIf
import warnings
+from unittest import skipIf
from xml.dom.minidom import parseString
-try:
- import pytz
-except ImportError:
- pytz = None
-
from django.core import serializers
from django.core.urlresolvers import reverse
-from django.db.models import Min, Max
+from django.db.models import Max, Min
from django.http import HttpRequest
from django.template import (
- context_processors, Context, RequestContext, Template, TemplateSyntaxError)
+ Context, RequestContext, Template, TemplateSyntaxError, context_processors,
+)
from django.test import (
- TestCase, override_settings, skipIfDBFeature, skipUnlessDBFeature)
+ TestCase, override_settings, skipIfDBFeature, skipUnlessDBFeature,
+)
from django.test.utils import requires_tz_support
-from django.utils import six
-from django.utils import timezone
+from django.utils import six, timezone
-from .forms import EventForm, EventSplitForm, EventLocalizedForm, EventModelForm, EventLocalizedModelForm
-from .models import Event, MaybeEvent, Session, SessionEvent, Timestamp, AllDayEvent
+from .forms import (
+ EventForm, EventLocalizedForm, EventLocalizedModelForm, EventModelForm,
+ EventSplitForm,
+)
+from .models import (
+ AllDayEvent, Event, MaybeEvent, Session, SessionEvent, Timestamp,
+)
+try:
+ import pytz
+except ImportError:
+ pytz = None
# These tests use the EAT (Eastern Africa Time) and ICT (Indochina Time)
# who don't have Daylight Saving Time, so we can represent them easily
diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py
index bf4735e0d2..dab406dbac 100644
--- a/tests/transactions/tests.py
+++ b/tests/transactions/tests.py
@@ -5,9 +5,13 @@ import threading
import time
from unittest import skipIf, skipUnless
-from django.db import (connection, transaction,
- DatabaseError, Error, IntegrityError, OperationalError)
-from django.test import TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature
+from django.db import (
+ DatabaseError, Error, IntegrityError, OperationalError, connection,
+ transaction,
+)
+from django.test import (
+ TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature,
+)
from django.utils import six
from .models import Reporter
diff --git a/tests/unmanaged_models/models.py b/tests/unmanaged_models/models.py
index b0dd5c8719..61eb67a620 100644
--- a/tests/unmanaged_models/models.py
+++ b/tests/unmanaged_models/models.py
@@ -6,6 +6,7 @@ is generated for the table on various manage.py operations.
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
+
# All of these models are created in the database by Django.
diff --git a/tests/unmanaged_models/tests.py b/tests/unmanaged_models/tests.py
index b103cd3adc..4ed07bf0d2 100644
--- a/tests/unmanaged_models/tests.py
+++ b/tests/unmanaged_models/tests.py
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from django.db import connection
from django.test import TestCase
-from .models import A01, A02, B01, B02, C01, C02, Unmanaged2, Managed1
+from .models import A01, A02, B01, B02, C01, C02, Managed1, Unmanaged2
class SimpleTests(TestCase):
diff --git a/tests/update/tests.py b/tests/update/tests.py
index 578b3ab440..1ed316c958 100644
--- a/tests/update/tests.py
+++ b/tests/update/tests.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
from django.test import TestCase
-from .models import A, B, D, DataPoint, RelatedPoint, Foo, Bar
+from .models import A, B, D, Bar, DataPoint, Foo, RelatedPoint
class SimpleTest(TestCase):
diff --git a/tests/update_only_fields/tests.py b/tests/update_only_fields/tests.py
index 095858fa49..34519cce4c 100644
--- a/tests/update_only_fields/tests.py
+++ b/tests/update_only_fields/tests.py
@@ -1,9 +1,9 @@
from __future__ import unicode_literals
-from django.db.models.signals import pre_save, post_save
+from django.db.models.signals import post_save, pre_save
from django.test import TestCase
-from .models import Person, Employee, ProxyEmployee, Profile, Account
+from .models import Account, Employee, Person, Profile, ProxyEmployee
class UpdateOnlyFieldsTests(TestCase):
diff --git a/tests/urlpatterns_reverse/extra_urls.py b/tests/urlpatterns_reverse/extra_urls.py
index c30a61a99a..d9c518c219 100644
--- a/tests/urlpatterns_reverse/extra_urls.py
+++ b/tests/urlpatterns_reverse/extra_urls.py
@@ -2,11 +2,10 @@
Some extra URL patterns that are included at the top level.
"""
-from django.conf.urls import url, include
+from django.conf.urls import include, url
from .views import empty_view
-
urlpatterns = [
url(r'^e-places/([0-9]+)/$', empty_view, name='extra-places'),
url(r'^e-people/(?P<name>\w+)/$', empty_view, name="extra-people"),
diff --git a/tests/urlpatterns_reverse/included_named_urls.py b/tests/urlpatterns_reverse/included_named_urls.py
index a4c6afea57..fac37ef714 100644
--- a/tests/urlpatterns_reverse/included_named_urls.py
+++ b/tests/urlpatterns_reverse/included_named_urls.py
@@ -1,8 +1,7 @@
-from django.conf.urls import url, include
+from django.conf.urls import include, url
from .views import empty_view
-
urlpatterns = [
url(r'^$', empty_view, name="named-url3"),
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url4"),
diff --git a/tests/urlpatterns_reverse/included_named_urls2.py b/tests/urlpatterns_reverse/included_named_urls2.py
index 47411ec620..4d617c3790 100644
--- a/tests/urlpatterns_reverse/included_named_urls2.py
+++ b/tests/urlpatterns_reverse/included_named_urls2.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from .views import empty_view
-
urlpatterns = [
url(r'^$', empty_view, name="named-url5"),
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url6"),
diff --git a/tests/urlpatterns_reverse/included_namespace_urls.py b/tests/urlpatterns_reverse/included_namespace_urls.py
index 2472e7c07d..8769f112e9 100644
--- a/tests/urlpatterns_reverse/included_namespace_urls.py
+++ b/tests/urlpatterns_reverse/included_namespace_urls.py
@@ -1,12 +1,11 @@
import warnings
-from django.conf.urls import patterns, url, include
+from django.conf.urls import include, patterns, url
from django.utils.deprecation import RemovedInDjango20Warning
from .namespace_urls import URLObject
from .views import view_class_instance
-
testobj3 = URLObject('testapp', 'test-ns3')
# test deprecated patterns() function. convert to list of urls() in Django 2.0
diff --git a/tests/urlpatterns_reverse/included_no_kwargs_urls.py b/tests/urlpatterns_reverse/included_no_kwargs_urls.py
index 0c291e0de2..f124a09b2f 100644
--- a/tests/urlpatterns_reverse/included_no_kwargs_urls.py
+++ b/tests/urlpatterns_reverse/included_no_kwargs_urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from .views import empty_view
-
urlpatterns = [
url(r'^inner-no-kwargs/([0-9]+)/', empty_view, name="inner-no-kwargs")
]
diff --git a/tests/urlpatterns_reverse/included_urls.py b/tests/urlpatterns_reverse/included_urls.py
index f8e69cb761..240d9e5665 100644
--- a/tests/urlpatterns_reverse/included_urls.py
+++ b/tests/urlpatterns_reverse/included_urls.py
@@ -2,7 +2,6 @@ from django.conf.urls import url
from .views import empty_view
-
urlpatterns = [
url(r'^$', empty_view, name="inner-nothing"),
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="inner-extra"),
diff --git a/tests/urlpatterns_reverse/included_urls2.py b/tests/urlpatterns_reverse/included_urls2.py
index ac8c770e7f..4a4aef8d95 100644
--- a/tests/urlpatterns_reverse/included_urls2.py
+++ b/tests/urlpatterns_reverse/included_urls2.py
@@ -9,7 +9,6 @@ from django.conf.urls import url
from .views import empty_view
-
urlpatterns = [
url(r'^part/(?P<value>\w+)/$', empty_view, name="part"),
url(r'^part2/(?:(?P<value>\w+)/)?$', empty_view, name="part2"),
diff --git a/tests/urlpatterns_reverse/named_urls.py b/tests/urlpatterns_reverse/named_urls.py
index 3f31249735..647c2630cf 100644
--- a/tests/urlpatterns_reverse/named_urls.py
+++ b/tests/urlpatterns_reverse/named_urls.py
@@ -1,8 +1,7 @@
-from django.conf.urls import url, include
+from django.conf.urls import include, url
from .views import empty_view
-
urlpatterns = [
url(r'^$', empty_view, name="named-url1"),
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url2"),
diff --git a/tests/urlpatterns_reverse/namespace_urls.py b/tests/urlpatterns_reverse/namespace_urls.py
index 12cf85f7d3..e1bb7479e9 100644
--- a/tests/urlpatterns_reverse/namespace_urls.py
+++ b/tests/urlpatterns_reverse/namespace_urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls import url, include
+from django.conf.urls import include, url
from . import views
diff --git a/tests/urlpatterns_reverse/reverse_lazy_urls.py b/tests/urlpatterns_reverse/reverse_lazy_urls.py
index 57358f6254..694b23fad6 100644
--- a/tests/urlpatterns_reverse/reverse_lazy_urls.py
+++ b/tests/urlpatterns_reverse/reverse_lazy_urls.py
@@ -1,6 +1,6 @@
from django.conf.urls import url
-from .views import empty_view, LazyRedirectView, login_required_view
+from .views import LazyRedirectView, empty_view, login_required_view
urlpatterns = [
url(r'^redirected_to/$', empty_view, name='named-lazy-url-redirected-to'),
diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py
index 7b46d0a0a3..3835e09c08 100644
--- a/tests/urlpatterns_reverse/tests.py
+++ b/tests/urlpatterns_reverse/tests.py
@@ -7,24 +7,26 @@ from __future__ import unicode_literals
import sys
import unittest
-from django.contrib.auth.models import User
+from admin_scripts.tests import AdminScriptTestCase
+
from django.conf import settings
+from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
-from django.core.urlresolvers import (reverse, reverse_lazy, resolve, get_callable,
- get_resolver, NoReverseMatch, Resolver404, ResolverMatch, RegexURLResolver,
- RegexURLPattern)
-from django.http import HttpRequest, HttpResponseRedirect, HttpResponsePermanentRedirect
+from django.core.urlresolvers import (
+ NoReverseMatch, RegexURLPattern, RegexURLResolver, Resolver404,
+ ResolverMatch, get_callable, get_resolver, resolve, reverse, reverse_lazy,
+)
+from django.http import (
+ HttpRequest, HttpResponsePermanentRedirect, HttpResponseRedirect,
+)
from django.shortcuts import redirect
from django.test import TestCase, ignore_warnings, override_settings
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
-from admin_scripts.tests import AdminScriptTestCase
-
-from . import urlconf_outer, middleware, views
+from . import middleware, urlconf_outer, views
from .views import empty_view
-
resolve_test_data = (
# These entries are in the format: (path, url_name, app_name, namespace, view_name, func, args, kwargs)
# Simple case
diff --git a/tests/urlpatterns_reverse/urlconf_inner.py b/tests/urlpatterns_reverse/urlconf_inner.py
index d55c4dc650..2a8ed7e26f 100644
--- a/tests/urlpatterns_reverse/urlconf_inner.py
+++ b/tests/urlpatterns_reverse/urlconf_inner.py
@@ -1,6 +1,6 @@
from django.conf.urls import url
-from django.template import Template, Context
from django.http import HttpResponse
+from django.template import Context, Template
def inner_view(request):
diff --git a/tests/urlpatterns_reverse/urlconf_outer.py b/tests/urlpatterns_reverse/urlconf_outer.py
index 36b6529efa..65cf507aa4 100644
--- a/tests/urlpatterns_reverse/urlconf_outer.py
+++ b/tests/urlpatterns_reverse/urlconf_outer.py
@@ -1,8 +1,7 @@
-from django.conf.urls import url, include
+from django.conf.urls import include, url
from . import urlconf_inner
-
urlpatterns = [
url(r'^test/me/$', urlconf_inner.inner_view, name='outer'),
url(r'^inner_urlconf/', include(urlconf_inner.__name__))
diff --git a/tests/urlpatterns_reverse/urls.py b/tests/urlpatterns_reverse/urls.py
index 825ded40a2..9b5a5f29fa 100644
--- a/tests/urlpatterns_reverse/urls.py
+++ b/tests/urlpatterns_reverse/urls.py
@@ -1,6 +1,6 @@
import warnings
-from django.conf.urls import patterns, url, include
+from django.conf.urls import include, patterns, url
from django.utils.deprecation import RemovedInDjango20Warning
from .views import (
@@ -8,7 +8,6 @@ from .views import (
empty_view_wrapped, nested_view,
)
-
other_patterns = [
url(r'non_path_include/$', empty_view, name='non_path_include'),
url(r'nested_path/$', nested_view),
diff --git a/tests/urlpatterns_reverse/urls_error_handlers_callables.py b/tests/urlpatterns_reverse/urls_error_handlers_callables.py
index 5fe8c728ff..4a8d35116e 100644
--- a/tests/urlpatterns_reverse/urls_error_handlers_callables.py
+++ b/tests/urlpatterns_reverse/urls_error_handlers_callables.py
@@ -2,7 +2,6 @@
from .views import empty_view
-
urlpatterns = []
handler400 = empty_view
diff --git a/tests/urlpatterns_reverse/urls_without_full_import.py b/tests/urlpatterns_reverse/urls_without_full_import.py
index 5178a9cfe0..5bbb0955e6 100644
--- a/tests/urlpatterns_reverse/urls_without_full_import.py
+++ b/tests/urlpatterns_reverse/urls_without_full_import.py
@@ -3,8 +3,7 @@
# import pattern.
from django.conf.urls import url
-from .views import empty_view, bad_view
-
+from .views import bad_view, empty_view
urlpatterns = [
url(r'^test_view/$', empty_view, name="test_view"),
diff --git a/tests/urlpatterns_reverse/views.py b/tests/urlpatterns_reverse/views.py
index efd5689c31..9fd2ad166e 100644
--- a/tests/urlpatterns_reverse/views.py
+++ b/tests/urlpatterns_reverse/views.py
@@ -1,10 +1,9 @@
from functools import partial, update_wrapper
+from django.contrib.auth.decorators import user_passes_test
+from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponse
from django.views.generic import RedirectView
-from django.core.urlresolvers import reverse_lazy
-
-from django.contrib.auth.decorators import user_passes_test
def empty_view(request, *args, **kwargs):
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py
index 40ffca95cb..35de5367ca 100644
--- a/tests/user_commands/tests.py
+++ b/tests/user_commands/tests.py
@@ -1,15 +1,15 @@
import os
from django.apps import apps
-from django.db import connection
from django.core import management
from django.core.management import BaseCommand, CommandError, find_commands
from django.core.management.utils import find_command, popen_wrapper
+from django.db import connection
from django.test import SimpleTestCase, ignore_warnings
from django.test.utils import captured_stderr, captured_stdout, extend_sys_path
from django.utils import translation
-from django.utils.deprecation import RemovedInDjango20Warning
from django.utils._os import upath
+from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.six import StringIO
diff --git a/tests/utils_tests/test_archive.py b/tests/utils_tests/test_archive.py
index 6f1b66b14b..d1dc5f2841 100644
--- a/tests/utils_tests/test_archive.py
+++ b/tests/utils_tests/test_archive.py
@@ -3,9 +3,8 @@ import shutil
import tempfile
import unittest
-from django.utils.archive import Archive, extract
from django.utils._os import upath
-
+from django.utils.archive import Archive, extract
TEST_DIR = os.path.join(os.path.dirname(upath(__file__)), 'archives')
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index c0865cba57..c3d20325cd 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -1,12 +1,12 @@
-from importlib import import_module
import os
import tempfile
+from importlib import import_module
from django import conf
from django.contrib import admin
from django.test import TestCase, override_settings
-from django.utils.autoreload import gen_filenames
from django.utils._os import upath
+from django.utils.autoreload import gen_filenames
LOCALE_PATH = os.path.join(os.path.dirname(__file__), 'locale')
diff --git a/tests/utils_tests/test_baseconv.py b/tests/utils_tests/test_baseconv.py
index 26ba126eb7..94c2d73b73 100644
--- a/tests/utils_tests/test_baseconv.py
+++ b/tests/utils_tests/test_baseconv.py
@@ -1,6 +1,8 @@
from unittest import TestCase
-from django.utils.baseconv import base2, base16, base36, base56, base62, base64, BaseConverter
+from django.utils.baseconv import (
+ BaseConverter, base2, base16, base36, base56, base62, base64,
+)
from django.utils.six.moves import range
diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py
index 425186c578..8562cd0d42 100644
--- a/tests/utils_tests/test_datastructures.py
+++ b/tests/utils_tests/test_datastructures.py
@@ -5,9 +5,11 @@ Tests for stuff in django.utils.datastructures.
import copy
from django.test import SimpleTestCase
-from django.utils.datastructures import (DictWrapper, ImmutableList,
- MultiValueDict, MultiValueDictKeyError, OrderedSet)
from django.utils import six
+from django.utils.datastructures import (
+ DictWrapper, ImmutableList, MultiValueDict, MultiValueDictKeyError,
+ OrderedSet,
+)
class OrderedSetTests(SimpleTestCase):
diff --git a/tests/utils_tests/test_dateformat.py b/tests/utils_tests/test_dateformat.py
index c65f8beb1c..1edf01422d 100644
--- a/tests/utils_tests/test_dateformat.py
+++ b/tests/utils_tests/test_dateformat.py
@@ -1,13 +1,14 @@
from __future__ import unicode_literals
-from datetime import datetime, date
+from datetime import date, datetime
from django.test import TestCase, override_settings
from django.test.utils import TZ_SUPPORT, requires_tz_support
+from django.utils import dateformat, translation
from django.utils.dateformat import format
-from django.utils import dateformat
-from django.utils.timezone import utc, get_fixed_timezone, get_default_timezone, make_aware
-from django.utils import translation
+from django.utils.timezone import (
+ get_default_timezone, get_fixed_timezone, make_aware, utc,
+)
@override_settings(TIME_ZONE='Europe/Copenhagen')
diff --git a/tests/utils_tests/test_dateparse.py b/tests/utils_tests/test_dateparse.py
index a224e3b174..7d4767feb7 100644
--- a/tests/utils_tests/test_dateparse.py
+++ b/tests/utils_tests/test_dateparse.py
@@ -1,9 +1,11 @@
from __future__ import unicode_literals
-from datetime import date, time, datetime, timedelta
import unittest
+from datetime import date, datetime, time, timedelta
-from django.utils.dateparse import parse_date, parse_time, parse_datetime, parse_duration
+from django.utils.dateparse import (
+ parse_date, parse_datetime, parse_duration, parse_time,
+)
from django.utils.timezone import get_fixed_timezone
diff --git a/tests/utils_tests/test_datetime_safe.py b/tests/utils_tests/test_datetime_safe.py
index 655a7350d5..dcb519b8fb 100644
--- a/tests/utils_tests/test_datetime_safe.py
+++ b/tests/utils_tests/test_datetime_safe.py
@@ -1,6 +1,9 @@
import unittest
+from datetime import (
+ date as original_date, datetime as original_datetime,
+ time as original_time,
+)
-from datetime import date as original_date, datetime as original_datetime, time as original_time
from django.utils.datetime_safe import date, datetime, time
diff --git a/tests/utils_tests/test_decorators.py b/tests/utils_tests/test_decorators.py
index 8ef4737e54..16b861bf1a 100644
--- a/tests/utils_tests/test_decorators.py
+++ b/tests/utils_tests/test_decorators.py
@@ -1,7 +1,7 @@
from django.http import HttpResponse
from django.template import engines
from django.template.response import TemplateResponse
-from django.test import TestCase, RequestFactory
+from django.test import RequestFactory, TestCase
from django.utils.decorators import decorator_from_middleware
diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py
index be2670854f..81024bdf12 100644
--- a/tests/utils_tests/test_encoding.py
+++ b/tests/utils_tests/test_encoding.py
@@ -1,13 +1,13 @@
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
-import unittest
import datetime
+import unittest
from django.utils import six
from django.utils.encoding import (
- filepath_to_uri, force_bytes, force_text, escape_uri_path,
- iri_to_uri, uri_to_iri, smart_text,
+ escape_uri_path, filepath_to_uri, force_bytes, force_text, iri_to_uri,
+ smart_text, uri_to_iri,
)
from django.utils.http import urlquote_plus
diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py
index e8956a7a29..5f7687edf5 100644
--- a/tests/utils_tests/test_functional.py
+++ b/tests/utils_tests/test_functional.py
@@ -1,6 +1,6 @@
import unittest
-from django.utils.functional import lazy, lazy_property, cached_property
+from django.utils.functional import cached_property, lazy, lazy_property
class FunctionalTestCase(unittest.TestCase):
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index 6375f2280b..db49046682 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from datetime import datetime
import os
+from datetime import datetime
from unittest import TestCase
from django.test import ignore_warnings
diff --git a/tests/utils_tests/test_http.py b/tests/utils_tests/test_http.py
index ac103f15d6..19bfa79f1a 100644
--- a/tests/utils_tests/test_http.py
+++ b/tests/utils_tests/test_http.py
@@ -1,12 +1,11 @@
from __future__ import unicode_literals
-from datetime import datetime
import sys
import unittest
+from datetime import datetime
+from django.utils import http, six
from django.utils.datastructures import MultiValueDict
-from django.utils import http
-from django.utils import six
class TestUtilsHttp(unittest.TestCase):
diff --git a/tests/utils_tests/test_ipv6.py b/tests/utils_tests/test_ipv6.py
index 6cd0cebc84..802f0f596e 100644
--- a/tests/utils_tests/test_ipv6.py
+++ b/tests/utils_tests/test_ipv6.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
import unittest
-from django.utils.ipv6 import is_valid_ipv6_address, clean_ipv6_address
+from django.utils.ipv6 import clean_ipv6_address, is_valid_ipv6_address
class TestUtilsIPv6(unittest.TestCase):
diff --git a/tests/utils_tests/test_module/another_bad_module.py b/tests/utils_tests/test_module/another_bad_module.py
index eac25c4aa5..766456242d 100644
--- a/tests/utils_tests/test_module/another_bad_module.py
+++ b/tests/utils_tests/test_module/another_bad_module.py
@@ -1,4 +1,5 @@
from . import site
+
content = 'Another Bad Module'
site._registry.update({
diff --git a/tests/utils_tests/test_module/another_good_module.py b/tests/utils_tests/test_module/another_good_module.py
index fd69a3b30c..eccdaa4c59 100644
--- a/tests/utils_tests/test_module/another_good_module.py
+++ b/tests/utils_tests/test_module/another_good_module.py
@@ -1,4 +1,5 @@
from . import site
+
content = 'Another Good Module'
site._registry.update({
diff --git a/tests/utils_tests/test_module_loading.py b/tests/utils_tests/test_module_loading.py
index 2addc2649a..8d600cb6f0 100644
--- a/tests/utils_tests/test_module_loading.py
+++ b/tests/utils_tests/test_module_loading.py
@@ -1,16 +1,17 @@
import imp
-from importlib import import_module
import os
import sys
import unittest
+from importlib import import_module
from zipimport import zipimporter
from django.test import SimpleTestCase, modify_settings
from django.test.utils import extend_sys_path
from django.utils import six
-from django.utils.module_loading import (autodiscover_modules, import_string,
- module_has_submodule)
from django.utils._os import upath
+from django.utils.module_loading import (
+ autodiscover_modules, import_string, module_has_submodule,
+)
class DefaultLoader(unittest.TestCase):
diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py
index e23851815b..c3f18f12d4 100644
--- a/tests/utils_tests/test_safestring.py
+++ b/tests/utils_tests/test_safestring.py
@@ -1,13 +1,13 @@
from __future__ import unicode_literals
-from django.template import Template, Context
+from django.template import Context, Template
from django.test import TestCase
-from django.utils.encoding import force_text, force_bytes
+from django.utils import html, six, text
+from django.utils.encoding import force_bytes, force_text
from django.utils.functional import lazy
-from django.utils.safestring import mark_safe, mark_for_escaping, SafeData, EscapeData
-from django.utils import six
-from django.utils import text
-from django.utils import html
+from django.utils.safestring import (
+ EscapeData, SafeData, mark_for_escaping, mark_safe,
+)
lazystr = lazy(force_text, six.text_type)
lazybytes = lazy(force_bytes, bytes)
diff --git a/tests/utils_tests/test_termcolors.py b/tests/utils_tests/test_termcolors.py
index 9bbeb16f0c..6e1aa50124 100644
--- a/tests/utils_tests/test_termcolors.py
+++ b/tests/utils_tests/test_termcolors.py
@@ -1,7 +1,9 @@
import unittest
-from django.utils.termcolors import (parse_color_setting, PALETTES,
- DEFAULT_PALETTE, LIGHT_PALETTE, DARK_PALETTE, NOCOLOR_PALETTE, colorize)
+from django.utils.termcolors import (
+ DARK_PALETTE, DEFAULT_PALETTE, LIGHT_PALETTE, NOCOLOR_PALETTE, PALETTES,
+ colorize, parse_color_setting,
+)
class TermColorTests(unittest.TestCase):
diff --git a/tests/utils_tests/test_timesince.py b/tests/utils_tests/test_timesince.py
index 376e425a88..90d33d00f7 100644
--- a/tests/utils_tests/test_timesince.py
+++ b/tests/utils_tests/test_timesince.py
@@ -4,8 +4,8 @@ import datetime
import unittest
from django.test.utils import requires_tz_support
-from django.utils.timesince import timesince, timeuntil
from django.utils import timezone
+from django.utils.timesince import timesince, timeuntil
class TimesinceTests(unittest.TestCase):
diff --git a/tests/utils_tests/test_timezone.py b/tests/utils_tests/test_timezone.py
index 9414a6097e..ff1a210e8b 100644
--- a/tests/utils_tests/test_timezone.py
+++ b/tests/utils_tests/test_timezone.py
@@ -3,15 +3,14 @@ import datetime
import pickle
import unittest
+from django.test import override_settings
+from django.utils import timezone
+
try:
import pytz
except ImportError:
pytz = None
-from django.test import override_settings
-from django.utils import timezone
-
-
if pytz is not None:
CET = pytz.timezone("Europe/Paris")
EAT = timezone.get_fixed_timezone(180) # Africa/Nairobi
diff --git a/tests/validation/test_unique.py b/tests/validation/test_unique.py
index 76c7ec174f..2abe85c82c 100644
--- a/tests/validation/test_unique.py
+++ b/tests/validation/test_unique.py
@@ -8,9 +8,10 @@ from django.core.exceptions import ValidationError
from django.db import models
from django.test import TestCase
-from .models import (CustomPKModel, UniqueTogetherModel, UniqueFieldsModel,
- UniqueForDateModel, ModelToValidate, Post, FlexibleDatePost,
- UniqueErrorsModel)
+from .models import (
+ CustomPKModel, FlexibleDatePost, ModelToValidate, Post, UniqueErrorsModel,
+ UniqueFieldsModel, UniqueForDateModel, UniqueTogetherModel,
+)
class GetUniqueCheckTests(unittest.TestCase):
diff --git a/tests/validation/tests.py b/tests/validation/tests.py
index 2a7549a461..defd66edec 100644
--- a/tests/validation/tests.py
+++ b/tests/validation/tests.py
@@ -5,8 +5,10 @@ from django.core.exceptions import NON_FIELD_ERRORS
from django.test import TestCase
from . import ValidationTestCase
-from .models import (Author, Article, ModelToValidate,
- GenericIPAddressTestModel, GenericIPAddrUnpackUniqueTest)
+from .models import (
+ Article, Author, GenericIPAddressTestModel, GenericIPAddrUnpackUniqueTest,
+ ModelToValidate,
+)
class BaseModelValidationTests(ValidationTestCase):
diff --git a/tests/validators/tests.py b/tests/validators/tests.py
index 3e434910d8..869c6d91cb 100644
--- a/tests/validators/tests.py
+++ b/tests/validators/tests.py
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-from datetime import datetime, timedelta
import io
import os
import re
import types
+from datetime import datetime, timedelta
from unittest import TestCase
from django.core.exceptions import ValidationError
@@ -13,14 +13,13 @@ from django.core.validators import (
BaseValidator, EmailValidator, MaxLengthValidator, MaxValueValidator,
MinLengthValidator, MinValueValidator, RegexValidator, URLValidator,
validate_comma_separated_integer_list, validate_email, validate_integer,
- validate_ipv46_address, validate_ipv4_address, validate_ipv6_address,
+ validate_ipv4_address, validate_ipv6_address, validate_ipv46_address,
validate_slug,
)
from django.test import SimpleTestCase
from django.test.utils import str_prefix
from django.utils._os import upath
-
NOW = datetime.now()
EXTENDED_SCHEMES = ['http', 'https', 'ftp', 'ftps', 'git', 'file']
diff --git a/tests/view_tests/default_urls.py b/tests/view_tests/default_urls.py
index 1e202472f4..2811bf7740 100644
--- a/tests/view_tests/default_urls.py
+++ b/tests/view_tests/default_urls.py
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
-
from django.contrib import admin
urlpatterns = [
diff --git a/tests/view_tests/generic_urls.py b/tests/view_tests/generic_urls.py
index ed15f55486..9e73a07649 100644
--- a/tests/view_tests/generic_urls.py
+++ b/tests/view_tests/generic_urls.py
@@ -5,8 +5,8 @@ from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.views.generic import RedirectView
-from .models import Article, DateArticle
from . import views
+from .models import Article, DateArticle
date_based_info_dict = {
'queryset': Article.objects.all(),
diff --git a/tests/view_tests/templatetags/debugtags.py b/tests/view_tests/templatetags/debugtags.py
index 1b9f3f9828..443a89f32c 100644
--- a/tests/view_tests/templatetags/debugtags.py
+++ b/tests/view_tests/templatetags/debugtags.py
@@ -2,7 +2,6 @@ from django import template
from ..views import BrokenException
-
register = template.Library()
diff --git a/tests/view_tests/tests/test_csrf.py b/tests/view_tests/tests/test_csrf.py
index 26ec221e01..4d82588f88 100644
--- a/tests/view_tests/tests/test_csrf.py
+++ b/tests/view_tests/tests/test_csrf.py
@@ -1,4 +1,4 @@
-from django.test import TestCase, override_settings, Client
+from django.test import Client, TestCase, override_settings
from django.utils.translation import override
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index 8645bd3e8e..547b96ffc3 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -16,16 +16,17 @@ from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from django.template.base import TemplateDoesNotExist
-from django.test import TestCase, RequestFactory, override_settings
-from django.utils.encoding import force_text, force_bytes
+from django.test import RequestFactory, TestCase, override_settings
from django.utils import six
+from django.utils.encoding import force_bytes, force_text
from django.views.debug import CallableSettingWrapper, ExceptionReporter
from .. import BrokenException, except_args
-from ..views import (sensitive_view, non_sensitive_view, paranoid_view,
- custom_exception_reporter_filter_view, sensitive_method_view,
- sensitive_args_function_caller, sensitive_kwargs_function_caller,
- multivalue_dict_key_error)
+from ..views import (
+ custom_exception_reporter_filter_view, multivalue_dict_key_error,
+ non_sensitive_view, paranoid_view, sensitive_args_function_caller,
+ sensitive_kwargs_function_caller, sensitive_method_view, sensitive_view,
+)
class CallableSettingWrapperTests(TestCase):
diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py
index ba51d3289b..2f47007b04 100644
--- a/tests/view_tests/tests/test_i18n.py
+++ b/tests/view_tests/tests/test_i18n.py
@@ -2,17 +2,18 @@
import gettext
import json
import os
-from os import path
import unittest
+from os import path
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import (
- LiveServerTestCase, TestCase, modify_settings, override_settings)
+ LiveServerTestCase, TestCase, modify_settings, override_settings,
+)
from django.utils import six
from django.utils._os import upath
from django.utils.module_loading import import_string
-from django.utils.translation import override, LANGUAGE_SESSION_KEY
+from django.utils.translation import LANGUAGE_SESSION_KEY, override
from ..urls import locale_dir
diff --git a/tests/view_tests/tests/test_static.py b/tests/view_tests/tests/test_static.py
index 5a353806e1..f1b0bf5b75 100644
--- a/tests/view_tests/tests/test_static.py
+++ b/tests/view_tests/tests/test_static.py
@@ -1,8 +1,8 @@
from __future__ import unicode_literals
import mimetypes
-from os import path
import unittest
+from os import path
from django.conf.urls.static import static
from django.http import FileResponse, HttpResponseNotModified
diff --git a/tests/view_tests/urls.py b/tests/view_tests/urls.py
index 0dfc2d4446..0bfcd587c2 100644
--- a/tests/view_tests/urls.py
+++ b/tests/view_tests/urls.py
@@ -1,13 +1,12 @@
# -*- coding: utf-8 -*-
from os import path
-from django.conf.urls import url, include
+from django.conf.urls import include, url
from django.utils._os import upath
from django.views import defaults, i18n, static
from . import views
-
base_dir = path.dirname(path.abspath(upath(__file__)))
media_dir = path.join(base_dir, 'media')
locale_dir = path.join(base_dir, 'locale')
diff --git a/tests/view_tests/views.py b/tests/view_tests/views.py
index 16bee28248..4be67bfc6f 100644
--- a/tests/view_tests/views.py
+++ b/tests/view_tests/views.py
@@ -6,14 +6,18 @@ import sys
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.core.urlresolvers import get_resolver
-from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, Http404
-from django.shortcuts import render_to_response, render
+from django.http import (
+ Http404, HttpResponse, HttpResponseRedirect, JsonResponse,
+)
+from django.shortcuts import render, render_to_response
from django.template import TemplateDoesNotExist
-from django.views.debug import technical_500_response, SafeExceptionReporterFilter
-from django.views.decorators.debug import (sensitive_post_parameters,
- sensitive_variables)
from django.utils.log import getLogger
-
+from django.views.debug import (
+ SafeExceptionReporterFilter, technical_500_response,
+)
+from django.views.decorators.debug import (
+ sensitive_post_parameters, sensitive_variables,
+)
from django.views.generic import View
from . import BrokenException, except_args
diff --git a/tests/wsgi/urls.py b/tests/wsgi/urls.py
index e7505c717b..1d7f91b689 100644
--- a/tests/wsgi/urls.py
+++ b/tests/wsgi/urls.py
@@ -1,5 +1,5 @@
from django.conf.urls import url
-from django.http import HttpResponse, FileResponse
+from django.http import FileResponse, HttpResponse
def helloworld(request):