From 321e94fa41b121f65c02119c02098df327bbd569 Mon Sep 17 00:00:00 2001
From: za
Date: Thu, 27 Oct 2016 14:53:39 +0700
Subject: [PATCH] Refs #27392 -- Removed "Tests that", "Ensures that", etc.
from test docstrings.
---
.../writing-code/coding-style.txt | 13 ++
tests/admin_changelist/tests.py | 24 +-
tests/admin_checks/tests.py | 9 +-
tests/admin_custom_urls/tests.py | 19 +-
tests/admin_filters/tests.py | 6 +-
tests/admin_inlines/tests.py | 45 ++--
tests/admin_ordering/tests.py | 2 +-
tests/admin_scripts/tests.py | 6 +-
tests/admin_utils/tests.py | 8 +-
tests/admin_views/admin.py | 2 -
tests/admin_views/tests.py | 205 ++++++++----------
tests/admin_widgets/tests.py | 62 ++----
tests/aggregation/tests.py | 11 +-
tests/aggregation_regress/tests.py | 30 +--
tests/annotations/tests.py | 8 +-
tests/apps/tests.py | 6 +-
tests/auth_tests/test_auth_backends.py | 32 +--
tests/auth_tests/test_basic.py | 4 +-
tests/auth_tests/test_context_processors.py | 8 +-
tests/auth_tests/test_decorators.py | 12 +-
tests/auth_tests/test_deprecated_views.py | 4 +-
tests/auth_tests/test_forms.py | 2 +-
tests/auth_tests/test_handlers.py | 9 +-
tests/auth_tests/test_hashers.py | 10 +-
tests/auth_tests/test_mixins.py | 4 +-
tests/auth_tests/test_models.py | 2 -
tests/auth_tests/test_remote_user.py | 10 +-
tests/auth_tests/test_signals.py | 2 +-
tests/auth_tests/test_tokens.py | 9 +-
tests/auth_tests/test_views.py | 19 +-
tests/backends/tests.py | 58 ++---
tests/basic/tests.py | 7 +-
tests/builtin_server/tests.py | 7 +-
tests/cache/tests.py | 46 ++--
tests/contenttypes_tests/test_models.py | 23 +-
tests/contenttypes_tests/tests.py | 4 +-
tests/context_processors/tests.py | 2 +-
tests/csrf_tests/tests.py | 37 ++--
tests/custom_managers/tests.py | 20 +-
tests/decorators/tests.py | 11 +-
tests/defer/tests.py | 3 +-
tests/delete/tests.py | 2 +-
tests/expressions/tests.py | 12 +-
tests/extra_regress/tests.py | 2 +-
tests/file_storage/tests.py | 13 +-
tests/file_uploads/tests.py | 4 +-
tests/file_uploads/views.py | 3 +-
tests/files/tests.py | 8 +-
tests/fixtures/tests.py | 12 +-
tests/fixtures_regress/tests.py | 20 +-
tests/foreign_object/test_empty_join.py | 2 +-
tests/foreign_object/tests.py | 1 -
tests/forms_tests/tests/test_forms.py | 20 +-
tests/forms_tests/tests/test_formsets.py | 9 +-
tests/forms_tests/tests/test_input_formats.py | 144 ++++++------
tests/forms_tests/tests/test_media.py | 2 +-
tests/forms_tests/tests/test_utils.py | 2 +-
tests/forms_tests/tests/test_widgets.py | 2 +-
tests/forms_tests/tests/tests.py | 6 +-
.../widget_tests/test_nullbooleanselect.py | 3 +-
tests/generic_inline_admin/tests.py | 8 +-
tests/generic_relations/tests.py | 11 +-
tests/generic_relations_regress/tests.py | 14 +-
tests/generic_views/test_base.py | 18 +-
tests/generic_views/test_dates.py | 5 +-
tests/generic_views/test_list.py | 2 +-
tests/get_earliest_or_latest/tests.py | 45 ++--
tests/gis_tests/gdal_tests/test_raster.py | 2 +-
tests/gis_tests/geoadmin/tests.py | 2 +-
tests/gis_tests/geoapp/tests.py | 2 +-
.../gis_tests/gis_migrations/test_commands.py | 10 +-
tests/gis_tests/layermap/tests.py | 2 +-
tests/gis_tests/test_geoforms.py | 1 -
tests/gis_tests/tests.py | 4 +-
tests/handlers/tests.py | 4 +-
tests/httpwrappers/tests.py | 23 +-
tests/i18n/patterns/tests.py | 7 +-
tests/i18n/test_extraction.py | 14 +-
tests/i18n/test_percents.py | 2 +-
tests/i18n/tests.py | 33 ++-
tests/inspectdb/tests.py | 2 +-
tests/introspection/tests.py | 3 +-
.../test_relative_fields.py | 8 +-
tests/known_related_objects/models.py | 2 +-
tests/logging_tests/tests.py | 21 +-
tests/lookup/tests.py | 17 +-
tests/m2m_recursive/tests.py | 14 +-
tests/m2m_signals/tests.py | 2 +-
tests/m2m_through/tests.py | 2 +-
tests/m2m_through_regress/tests.py | 5 +-
tests/mail/tests.py | 35 ++-
tests/many_to_many/tests.py | 12 +-
tests/many_to_one/tests.py | 10 +-
tests/many_to_one_null/tests.py | 2 +-
tests/messages_tests/base.py | 14 +-
tests/messages_tests/test_cookie.py | 17 +-
tests/messages_tests/test_fallback.py | 30 +--
tests/messages_tests/test_session.py | 7 +-
tests/middleware/tests.py | 4 +-
tests/middleware_exceptions/test_legacy.py | 92 ++++----
.../migration_test_data_persistence/tests.py | 6 +-
tests/migrations/test_autodetector.py | 80 ++++---
tests/migrations/test_commands.py | 108 ++++-----
tests/migrations/test_executor.py | 6 +-
tests/migrations/test_graph.py | 4 +-
tests/migrations/test_multidb.py | 2 +-
tests/migrations/test_operations.py | 26 +--
tests/migrations/test_optimizer.py | 8 +-
tests/migrations/test_state.py | 29 ++-
tests/model_fields/test_charfield.py | 2 +-
tests/model_fields/test_imagefield.py | 12 +-
tests/model_fields/test_textfield.py | 2 +-
tests/model_fields/test_uuid.py | 2 +-
tests/model_forms/tests.py | 17 +-
tests/model_formsets/tests.py | 8 +-
tests/model_inheritance/tests.py | 12 +-
tests/model_inheritance_regress/models.py | 2 +-
tests/model_inheritance_regress/tests.py | 30 ++-
tests/model_regress/tests.py | 12 +-
tests/modeladmin/tests.py | 51 ++---
tests/multiple_database/tests.py | 45 ++--
tests/no_models/tests.py | 2 +-
tests/one_to_one/tests.py | 14 +-
tests/ordering/tests.py | 8 +-
tests/pagination/tests.py | 9 +-
tests/postgres_tests/test_unaccent.py | 4 +-
.../test_prefetch_related_objects.py | 4 +-
tests/prefetch_related/tests.py | 21 +-
tests/queries/tests.py | 33 ++-
tests/queryset_pickle/tests.py | 2 +-
tests/raw_query/tests.py | 7 +-
tests/requests/tests.py | 40 ++--
tests/resolve_url/tests.py | 31 ++-
tests/schema/tests.py | 32 +--
tests/select_for_update/tests.py | 19 +-
tests/serializers/models/data.py | 4 +-
tests/serializers/tests.py | 36 ++-
tests/servers/tests.py | 25 +--
tests/sessions_tests/tests.py | 6 +-
tests/settings_tests/tests.py | 4 +-
tests/signals/tests.py | 4 +-
tests/sitemaps_tests/test_http.py | 15 +-
tests/sites_tests/tests.py | 12 +-
tests/staticfiles_tests/test_liveserver.py | 2 +-
tests/staticfiles_tests/test_management.py | 8 +-
tests/staticfiles_tests/test_storage.py | 5 +-
tests/string_lookup/tests.py | 6 +-
tests/swappable_models/tests.py | 4 +-
tests/syndication_tests/tests.py | 23 +-
tests/template_backends/test_django.py | 4 +-
.../filter_tests/test_floatformat.py | 6 +-
.../template_tests/filter_tests/test_join.py | 3 +-
.../filter_tests/test_timesince.py | 4 +-
.../filter_tests/test_timeuntil.py | 2 +-
tests/template_tests/syntax_tests/test_for.py | 2 +-
.../syntax_tests/test_include.py | 4 +-
tests/template_tests/test_context.py | 2 +-
tests/template_tests/test_custom.py | 11 +-
tests/template_tests/test_engine.py | 4 +-
tests/test_client/tests.py | 40 +---
tests/test_client/views.py | 2 +-
tests/test_client_regress/tests.py | 40 ++--
tests/test_runner/test_parallel.py | 2 +-
tests/test_runner/tests.py | 6 +-
tests/test_utils/tests.py | 2 +-
tests/update/tests.py | 10 +-
tests/update_only_fields/tests.py | 2 +-
tests/urlpatterns_reverse/tests.py | 18 +-
tests/user_commands/tests.py | 4 +-
tests/utils_tests/test_autoreload.py | 9 +-
tests/utils_tests/test_datetime_safe.py | 2 +-
tests/utils_tests/test_decorators.py | 8 +-
tests/utils_tests/test_encoding.py | 4 +-
tests/utils_tests/test_feedgenerator.py | 21 +-
tests/utils_tests/test_functional.py | 13 +-
tests/utils_tests/test_html.py | 8 +-
tests/utils_tests/test_text.py | 9 +-
tests/validators/tests.py | 2 +-
tests/view_tests/tests/test_csrf.py | 4 +-
tests/view_tests/tests/test_debug.py | 57 ++---
tests/view_tests/tests/test_defaults.py | 3 +-
tests/view_tests/tests/test_specials.py | 5 +-
tests/view_tests/tests/test_static.py | 3 +-
tests/view_tests/views.py | 3 +-
tests/wsgi/tests.py | 5 +-
185 files changed, 1216 insertions(+), 1528 deletions(-)
diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt
index 39f49f10e6..7b7712919b 100644
--- a/docs/internals/contributing/writing-code/coding-style.txt
+++ b/docs/internals/contributing/writing-code/coding-style.txt
@@ -53,6 +53,19 @@ Python style
(``six.assertRaisesRegex()`` as long as we support Python 2) only if you need
to use regular expression matching.
+* In test docstrings, state the expected behavior that each test demonstrates.
+ Don't include preambles such as "Tests that" or "Ensures that".
+
+ Reserve ticket references for obscure issues where the ticket has additional
+ details that can't be easily described in docstrings or comments. Include the
+ ticket number at the end of a sentence like this::
+
+ def test_foo():
+ """
+ A test docstring looks like this (#123456).
+ """
+ ...
+
.. _coding-style-imports:
Imports
diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py
index 7d477a16d2..c501770761 100644
--- a/tests/admin_changelist/tests.py
+++ b/tests/admin_changelist/tests.py
@@ -134,7 +134,7 @@ class ChangeListTests(TestCase):
def test_result_list_set_empty_value_display_on_admin_site(self):
"""
- Test that empty value display can be set on AdminSite
+ Empty value display can be set on AdminSite.
"""
new_child = Child.objects.create(name='name', parent=None)
request = self.factory.get('/child/')
@@ -155,7 +155,7 @@ class ChangeListTests(TestCase):
def test_result_list_set_empty_value_display_in_model_admin(self):
"""
- Test that empty value display can be set in ModelAdmin or individual fields.
+ Empty value display can be set in ModelAdmin or individual fields.
"""
new_child = Child.objects.create(name='name', parent=None)
request = self.factory.get('/child/')
@@ -174,8 +174,8 @@ class ChangeListTests(TestCase):
def test_result_list_html(self):
"""
- Verifies that inclusion tag result_list generates a table when with
- default ModelAdmin settings.
+ Inclusion tag result_list generates a table when with default
+ ModelAdmin settings.
"""
new_parent = Parent.objects.create(name='parent')
new_child = Child.objects.create(name='name', parent=new_parent)
@@ -672,10 +672,9 @@ class ChangeListTests(TestCase):
def test_deterministic_order_for_unordered_model(self):
"""
- Ensure that the primary key is systematically used in the ordering of
- the changelist's results to guarantee a deterministic order, even
- when the Model doesn't have any default ordering defined.
- Refs #17198.
+ The primary key is used in the ordering of the changelist's results to
+ guarantee a deterministic order, even when the model doesn't have any
+ default ordering defined (#17198).
"""
superuser = self._create_superuser('superuser')
@@ -717,10 +716,9 @@ class ChangeListTests(TestCase):
def test_deterministic_order_for_model_ordered_by_its_manager(self):
"""
- Ensure that the primary key is systematically used in the ordering of
- the changelist's results to guarantee a deterministic order, even
- when the Model has a manager that defines a default ordering.
- Refs #17198.
+ The primary key is used in the ordering of the changelist's results to
+ guarantee a deterministic order, even when the model has a manager that
+ defines a default ordering (#17198).
"""
superuser = self._create_superuser('superuser')
@@ -887,7 +885,7 @@ class SeleniumTests(AdminSeleniumTestCase):
def test_add_row_selection(self):
"""
- Ensure that the status line for selected rows gets updated correctly (#22038)
+ The status line for selected rows gets updated correctly (#22038).
"""
self.admin_login(username='super', password='secret')
self.selenium.get(self.live_server_url + reverse('admin:auth_user_changelist'))
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py
index 2cf7f66d9d..fa1bcc1518 100644
--- a/tests/admin_checks/tests.py
+++ b/tests/admin_checks/tests.py
@@ -165,16 +165,15 @@ class SystemChecksTestCase(SimpleTestCase):
def test_custom_get_form_with_fieldsets(self):
"""
- Ensure that the fieldsets checks are skipped when the ModelAdmin.get_form() method
+ The fieldsets checks are skipped when the ModelAdmin.get_form() method
is overridden.
- Refs #19445.
"""
errors = ValidFormFieldsets(Song, AdminSite()).check()
self.assertEqual(errors, [])
def test_fieldsets_fields_non_tuple(self):
"""
- Tests for a tuple/list for the first fieldset's fields.
+ The first fieldset's fields must be a list/tuple.
"""
class NotATupleAdmin(admin.ModelAdmin):
list_display = ["pk", "title"]
@@ -197,7 +196,7 @@ class SystemChecksTestCase(SimpleTestCase):
def test_nonfirst_fieldset(self):
"""
- Tests for a tuple/list for the second fieldset's fields.
+ The second fieldset's fields must be a list/tuple.
"""
class NotATupleAdmin(admin.ModelAdmin):
fieldsets = [
@@ -309,7 +308,7 @@ class SystemChecksTestCase(SimpleTestCase):
def test_generic_inline_model_admin_non_generic_model(self):
"""
- Ensure that a model without a GenericForeignKey raises problems if it's included
+ A model without a GenericForeignKey raises problems if it's included
in an GenericInlineModelAdmin definition.
"""
class BookInline(GenericStackedInline):
diff --git a/tests/admin_custom_urls/tests.py b/tests/admin_custom_urls/tests.py
index 11a0375ae2..319e6f6653 100644
--- a/tests/admin_custom_urls/tests.py
+++ b/tests/admin_custom_urls/tests.py
@@ -68,9 +68,6 @@ class AdminCustomUrlsTest(TestCase):
self.assertContains(response, 'Action added through a popup')
def test_admin_URLs_no_clash(self):
- """
- Test that some admin URLs work correctly.
- """
# Should get the change_view for model instance with PK 'add', not show
# the add_view
url = reverse('admin_custom_urls:%s_action_change' % Action._meta.app_label, args=(quote('add'),))
@@ -89,10 +86,8 @@ class AdminCustomUrlsTest(TestCase):
def test_post_save_add_redirect(self):
"""
- Ensures that ModelAdmin.response_post_save_add() controls the
- redirection after the 'Save' button has been pressed when adding a
- new object.
- Refs 8001, 18310, 19505.
+ ModelAdmin.response_post_save_add() controls the redirection after
+ the 'Save' button has been pressed when adding a new object.
"""
post_data = {'name': 'John Doe'}
self.assertEqual(Person.objects.count(), 0)
@@ -104,10 +99,8 @@ class AdminCustomUrlsTest(TestCase):
def test_post_save_change_redirect(self):
"""
- Ensures that ModelAdmin.response_post_save_change() controls the
- redirection after the 'Save' button has been pressed when editing an
- existing object.
- Refs 8001, 18310, 19505.
+ ModelAdmin.response_post_save_change() controls the redirection after
+ the 'Save' button has been pressed when editing an existing object.
"""
Person.objects.create(name='John Doe')
self.assertEqual(Person.objects.count(), 1)
@@ -118,8 +111,8 @@ class AdminCustomUrlsTest(TestCase):
def test_post_url_continue(self):
"""
- Ensures that the ModelAdmin.response_add()'s parameter `post_url_continue`
- controls the redirection after an object has been created.
+ The ModelAdmin.response_add()'s parameter `post_url_continue` controls
+ the redirection after an object has been created.
"""
post_data = {'name': 'SuperFast', '_continue': '1'}
self.assertEqual(Car.objects.count(), 0)
diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py
index 940bb3ce8c..e2da7ec59e 100644
--- a/tests/admin_filters/tests.py
+++ b/tests/admin_filters/tests.py
@@ -891,7 +891,7 @@ class ListFiltersTests(TestCase):
def test_filter_with_failing_queryset(self):
"""
- Ensure that when a filter's queryset method fails, it fails loudly and
+ When a filter's queryset method fails, it fails loudly and
the corresponding exception doesn't get swallowed (#17828).
"""
modeladmin = DecadeFilterBookAdminWithFailingQueryset(Book, site)
@@ -941,8 +941,8 @@ class ListFiltersTests(TestCase):
def test_parameter_ends_with__in__or__isnull(self):
"""
- Ensure that a SimpleListFilter's parameter name is not mistaken for a
- model field if it ends with '__isnull' or '__in' (#17091).
+ A SimpleListFilter's parameter name is not mistaken for a model field
+ if it ends with '__isnull' or '__in' (#17091).
"""
# When it ends with '__in' -----------------------------------------
modeladmin = DecadeFilterBookAdminParameterEndsWith__In(Book, site)
diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
index 5871f16a3b..2716d2abdb 100644
--- a/tests/admin_inlines/tests.py
+++ b/tests/admin_inlines/tests.py
@@ -107,8 +107,8 @@ class TestInline(TestDataMixin, TestCase):
def test_tabular_non_field_errors(self):
"""
- Ensure that non_field_errors are displayed correctly, including the
- right value for colspan. Refs #13510.
+ non_field_errors are displayed correctly, including the correct value
+ for colspan.
"""
data = {
'title_set-TOTAL_FORMS': 1,
@@ -153,9 +153,8 @@ class TestInline(TestDataMixin, TestCase):
def test_help_text(self):
"""
- Ensure that the inlines' model field help texts are displayed when
- using both the stacked and tabular layouts.
- Ref #8190.
+ The inlines' model field help texts are displayed when using both the
+ stacked and tabular layouts.
"""
response = self.client.get(reverse('admin:admin_inlines_holder4_add'))
self.assertContains(response, '
Awesome stacked help text is awesome.
', 4)
@@ -191,8 +190,7 @@ class TestInline(TestDataMixin, TestCase):
def test_non_related_name_inline(self):
"""
- Ensure that multiple inlines with related_name='+' have correct form
- prefixes. Bug #16838.
+ Multiple inlines with related_name='+' have correct form prefixes.
"""
response = self.client.get(reverse('admin:admin_inlines_capofamiglia_add'))
self.assertContains(response, '', html=True)
@@ -221,8 +219,8 @@ class TestInline(TestDataMixin, TestCase):
@override_settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=True)
def test_localize_pk_shortcut(self):
"""
- Ensure that the "View on Site" link is correct for locales that use
- thousand separators
+ The "View on Site" link is correct for locales that use thousand
+ separators.
"""
holder = Holder.objects.create(pk=123456789, dummy=42)
inner = Inner.objects.create(pk=987654321, holder=holder, dummy=42, readonly='')
@@ -232,8 +230,8 @@ class TestInline(TestDataMixin, TestCase):
def test_custom_pk_shortcut(self):
"""
- Ensure that the "View on Site" link is correct for models with a
- custom primary key field. Bug #18433.
+ The "View on Site" link is correct for models with a custom primary key
+ field.
"""
parent = ParentModelWithCustomPk.objects.create(my_own_pk="foo", name="Foo")
child1 = ChildModel1.objects.create(my_own_pk="bar", name="Bar", parent=parent)
@@ -246,8 +244,7 @@ class TestInline(TestDataMixin, TestCase):
def test_create_inlines_on_inherited_model(self):
"""
- Ensure that an object can be created with inlines when it inherits
- another class. Bug #19524.
+ An object can be created with inlines when it inherits another class.
"""
data = {
'name': 'Martian',
@@ -285,7 +282,7 @@ class TestInline(TestDataMixin, TestCase):
def test_min_num(self):
"""
- Ensure that min_num and extra determine number of forms.
+ min_num and extra determine number of forms.
"""
class MinNumInline(TabularInline):
model = BinaryTree
@@ -309,9 +306,6 @@ class TestInline(TestDataMixin, TestCase):
self.assertContains(response, total_forms)
def test_custom_min_num(self):
- """
- Ensure that get_min_num is called and used correctly.
- """
bt_head = BinaryTree.objects.create(name="Tree Head")
BinaryTree.objects.create(name="First Child", parent=bt_head)
@@ -741,8 +735,7 @@ class SeleniumTests(AdminSeleniumTestCase):
def test_add_stackeds(self):
"""
- Ensure that the "Add another XXX" link correctly adds items to the
- stacked formset.
+ The "Add another XXX" link correctly adds items to the stacked formset.
"""
self.admin_login(username='super', password='secret')
self.selenium.get(self.live_server_url + reverse('admin:admin_inlines_holder4_add'))
@@ -781,14 +774,12 @@ class SeleniumTests(AdminSeleniumTestCase):
def test_add_inlines(self):
"""
- Ensure that the "Add another XXX" link correctly adds items to the
- inline form.
+ The "Add another XXX" link correctly adds items to the inline form.
"""
self.admin_login(username='super', password='secret')
self.selenium.get(self.live_server_url + reverse('admin:admin_inlines_profilecollection_add'))
- # Check that there's only one inline to start with and that it has the
- # correct ID.
+ # There's only one inline to start with and it has the correct ID.
self.assertEqual(len(self.selenium.find_elements_by_css_selector(
'.dynamic-profile_set')), 1)
self.assertEqual(self.selenium.find_elements_by_css_selector(
@@ -802,8 +793,8 @@ class SeleniumTests(AdminSeleniumTestCase):
# Add an inline
self.selenium.find_element_by_link_text('Add another Profile').click()
- # Check that the inline has been added, that it has the right id, and
- # that it contains the right fields.
+ # The inline has been added, it has the right id, and it contains the
+ # correct fields.
self.assertEqual(len(self.selenium.find_elements_by_css_selector('.dynamic-profile_set')), 2)
self.assertEqual(self.selenium.find_elements_by_css_selector(
'.dynamic-profile_set')[1].get_attribute('id'), 'profile_set-1')
@@ -833,7 +824,7 @@ class SeleniumTests(AdminSeleniumTestCase):
self.selenium.find_element_by_xpath('//input[@value="Save"]').click()
self.wait_page_loaded()
- # Check that the objects have been created in the database
+ # The objects have been created in the database
self.assertEqual(ProfileCollection.objects.all().count(), 1)
self.assertEqual(Profile.objects.all().count(), 3)
@@ -864,7 +855,7 @@ class SeleniumTests(AdminSeleniumTestCase):
'form#profilecollection_form tr.dynamic-profile_set#profile_set-1 td.delete a').click()
self.selenium.find_element_by_css_selector(
'form#profilecollection_form tr.dynamic-profile_set#profile_set-2 td.delete a').click()
- # Verify that they're gone and that the IDs have been re-sequenced
+ # The rows are gone and the IDs have been re-sequenced
self.assertEqual(len(self.selenium.find_elements_by_css_selector(
'#profile_set-group table tr.dynamic-profile_set')), 3)
self.assertEqual(len(self.selenium.find_elements_by_css_selector(
diff --git a/tests/admin_ordering/tests.py b/tests/admin_ordering/tests.py
index 6e19accc21..44d7beb368 100644
--- a/tests/admin_ordering/tests.py
+++ b/tests/admin_ordering/tests.py
@@ -156,7 +156,7 @@ class TestRelatedFieldsAdminOrdering(TestCase):
self.check_ordering_of_field_choices([self.b1, self.b2])
def test_custom_queryset_still_wins(self):
- """Test that custom queryset has still precedence (#21405)"""
+ """Custom queryset has still precedence (#21405)"""
class SongAdmin(admin.ModelAdmin):
# Exclude one of the two Bands from the querysets
def formfield_for_foreignkey(self, db_field, request, **kwargs):
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 329263db0a..656736be82 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -1428,8 +1428,8 @@ class ManageTestserver(AdminScriptTestCase):
##########################################################################
# COMMAND PROCESSING TESTS
-# Check that user-space commands are correctly handled - in particular,
-# that arguments to the commands are correctly parsed and processed.
+# user-space commands are correctly handled - in particular, arguments to
+# the commands are correctly parsed and processed.
##########################################################################
class CommandTypes(AdminScriptTestCase):
@@ -1671,7 +1671,7 @@ class CommandTypes(AdminScriptTestCase):
def test_run_from_argv_non_ascii_error(self):
"""
- Test that non-ASCII message of CommandError does not raise any
+ Non-ASCII message of CommandError does not raise any
UnicodeDecodeError in run_from_argv.
"""
def raise_command_error(*args, **kwargs):
diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py
index 2e72f5a05d..966a1f11f2 100644
--- a/tests/admin_utils/tests.py
+++ b/tests/admin_utils/tests.py
@@ -72,7 +72,7 @@ class NestedObjectsTests(TestCase):
def test_on_delete_do_nothing(self):
"""
- Check that the nested collector doesn't query for DO_NOTHING objects.
+ The nested collector doesn't query for DO_NOTHING objects.
"""
n = NestedObjects(using=DEFAULT_DB_ALIAS)
objs = [Event.objects.create()]
@@ -83,9 +83,9 @@ class NestedObjectsTests(TestCase):
def test_relation_on_abstract(self):
"""
- #21846 -- Check that `NestedObjects.collect()` doesn't trip
- (AttributeError) on the special notation for relations on abstract
- models (related_name that contains %(app_label)s and/or %(class)s).
+ NestedObjects.collect() doesn't trip (AttributeError) on the special
+ notation for relations on abstract models (related_name that contains
+ %(app_label)s and/or %(class)s) (#21846).
"""
n = NestedObjects(using=DEFAULT_DB_ALIAS)
Car.objects.create()
diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
index be38a14b03..2aa042c386 100644
--- a/tests/admin_views/admin.py
+++ b/tests/admin_views/admin.py
@@ -108,7 +108,6 @@ class ArticleAdmin(admin.ModelAdmin):
)
def changelist_view(self, request):
- "Test that extra_context works"
return super(ArticleAdmin, self).changelist_view(
request, extra_context={
'extra_var': 'Hello!'
@@ -163,7 +162,6 @@ class CustomArticleAdmin(admin.ModelAdmin):
delete_selected_confirmation_template = 'custom_admin/delete_selected_confirmation.html'
def changelist_view(self, request):
- "Test that extra_context works"
return super(CustomArticleAdmin, self).changelist_view(
request, extra_context={
'extra_var': 'Hello!'
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 0eae2e467a..0643448984 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -213,8 +213,8 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
def test_admin_static_template_tag(self):
"""
- Test that admin_static.static is pointing to the collectstatic version
- (as django.contrib.collectstatic is in installed apps).
+ admin_static.static points to the collectstatic version
+ (as django.contrib.collectstatic is in INSTALLED_APPS).
"""
old_url = staticfiles_storage.base_url
staticfiles_storage.base_url = '/test/'
@@ -486,8 +486,8 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
self.assertContentBefore(response, link1, link2)
def test_multiple_sort_same_field(self):
- # Check that we get the columns we expect if we have two columns
- # that correspond to the same ordering field
+ # The changelist displays the correct columns if two columns correspond
+ # to the same ordering field.
dt = datetime.datetime.now()
p1 = Podcast.objects.create(name="A", release_date=dt)
p2 = Podcast.objects.create(name="B", release_date=dt - datetime.timedelta(10))
@@ -517,9 +517,9 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
def test_sort_indicators_admin_order(self):
"""
- Ensures that the admin shows default sort indicators for all
- kinds of 'ordering' fields: field names, method on the model
- admin and model itself, and other callables. See #17252.
+ The admin shows default sort indicators for all kinds of 'ordering'
+ fields: field names, method on the model admin and model itself, and
+ other callables. See #17252.
"""
models = [(AdminOrderedField, 'adminorderedfield'),
(AdminOrderedModelMethod, 'adminorderedmodelmethod'),
@@ -857,9 +857,8 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
def test_change_view_with_show_delete_extra_context(self):
"""
- Ensured that the 'show_delete' context variable in the admin's change
- view actually controls the display of the delete button.
- Refs #10057.
+ The 'show_delete' context variable in the admin's change view controls
+ the display of the delete button.
"""
instance = UndeletableObject.objects.create(name='foo')
response = self.client.get(reverse('admin:admin_views_undeletableobject_change', args=(instance.pk,)))
@@ -867,11 +866,8 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
def test_allows_attributeerror_to_bubble_up(self):
"""
- Ensure that AttributeErrors are allowed to bubble when raised inside
- a change list view.
-
- Requires a model to be created so there's something to be displayed
-
+ AttributeErrors are allowed to bubble when raised inside a change list
+ view. Requires a model to be created so there's something to display.
Refs: #16655, #18593, and #18747
"""
Simple.objects.create()
@@ -881,9 +877,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
def test_changelist_with_no_change_url(self):
"""
ModelAdmin.changelist_view shouldn't result in a NoReverseMatch if url
- for change_view is removed from get_urls
-
- Regression test for #20934
+ for change_view is removed from get_urls (#20934).
"""
UnchangeableObject.objects.create()
response = self.client.get(reverse('admin:admin_views_unchangeableobject_changelist'))
@@ -977,7 +971,7 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
def test_extended_bodyclass_template_change_form(self):
"""
- Ensure that the admin/change_form.html template uses block.super in the
+ The admin/change_form.html template uses block.super in the
bodyclass block.
"""
response = self.client.get(reverse('admin:admin_views_section_add'))
@@ -997,15 +991,14 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
def test_extended_bodyclass_template_index(self):
"""
- Ensure that the admin/index.html template uses block.super in the
- bodyclass block.
+ The admin/index.html template uses block.super in the bodyclass block.
"""
response = self.client.get(reverse('admin:index'))
self.assertContains(response, 'bodyclass_consistency_check ')
def test_extended_bodyclass_change_list(self):
"""
- Ensure that the admin/change_list.html' template uses block.super
+ The admin/change_list.html' template uses block.super
in the bodyclass block.
"""
response = self.client.get(reverse('admin:admin_views_article_changelist'))
@@ -1013,7 +1006,7 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
def test_extended_bodyclass_template_login(self):
"""
- Ensure that the admin/login.html template uses block.super in the
+ The admin/login.html template uses block.super in the
bodyclass block.
"""
self.client.logout()
@@ -1022,7 +1015,7 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
def test_extended_bodyclass_template_delete_confirmation(self):
"""
- Ensure that the admin/delete_confirmation.html template uses
+ The admin/delete_confirmation.html template uses
block.super in the bodyclass block.
"""
group = Group.objects.create(name="foogroup")
@@ -1031,7 +1024,7 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
def test_extended_bodyclass_template_delete_selected_confirmation(self):
"""
- Ensure that the admin/delete_selected_confirmation.html template uses
+ The admin/delete_selected_confirmation.html template uses
block.super in bodyclass block.
"""
group = Group.objects.create(name="foogroup")
@@ -1047,8 +1040,7 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
def test_filter_with_custom_template(self):
"""
- Ensure that one can use a custom template to render an admin filter.
- Refs #17515.
+ A custom template can be used to render an admin filter.
"""
response = self.client.get(reverse('admin:admin_views_color2_changelist'))
self.assertTemplateUsed(response, 'custom_filter_template.html')
@@ -1078,7 +1070,7 @@ class AdminViewFormUrlTest(TestCase):
def test_change_form_URL_has_correct_value(self):
"""
- Tests whether change_view has form_url in response.context
+ change_view has form_url in response.context
"""
response = self.client.get(
reverse('admin:admin_views_section_change', args=(self.s1.pk,), current_app=self.current_app)
@@ -1088,10 +1080,8 @@ class AdminViewFormUrlTest(TestCase):
def test_initial_data_can_be_overridden(self):
"""
- Tests that the behavior for setting initial
- form data can be overridden in the ModelAdmin class.
-
- Usually, the initial value is set via the GET params.
+ The behavior for setting initial form data can be overridden in the
+ ModelAdmin class. Usually, the initial value is set via the GET params.
"""
response = self.client.get(
reverse('admin:admin_views_restaurant_add', current_app=self.current_app),
@@ -1115,9 +1105,7 @@ class AdminJavaScriptTest(TestCase):
def test_js_minified_only_if_debug_is_false(self):
"""
- Ensure that the minified versions of the JS files are only used when
- DEBUG is False.
- Refs #17521.
+ The minified versions of the JS files are only used when DEBUG is False.
"""
with override_settings(DEBUG=False):
response = self.client.get(reverse('admin:admin_views_section_add'))
@@ -1157,7 +1145,7 @@ class SaveAsTests(TestCase):
self.client.force_login(self.superuser)
def test_save_as_duplication(self):
- """Ensure save as actually creates a new person"""
+ """'save as' creates a new person"""
post_data = {'_saveasnew': '', 'name': 'John M', 'gender': 1, 'age': 42}
response = self.client.post(reverse('admin:admin_views_person_change', args=(self.per1.pk,)), post_data)
self.assertEqual(len(Person.objects.filter(name='John M')), 1)
@@ -1179,7 +1167,7 @@ class SaveAsTests(TestCase):
def test_save_as_new_with_validation_errors(self):
"""
- Ensure that when you click "Save as new" and have a validation error,
+ When you click "Save as new" and have a validation error,
you only see the "Save as new" button and not the other save buttons,
and that only the "Save as" button is visible.
"""
@@ -1609,7 +1597,7 @@ class AdminViewPermissionsTest(TestCase):
self.assertEqual(mail.outbox[0].subject, 'Greetings from a created object')
self.client.get(reverse('admin:logout'))
- # Check that the addition was logged correctly
+ # The addition was logged correctly
addition_log = LogEntry.objects.all()[0]
new_article = Article.objects.last()
article_ct = ContentType.objects.get_for_model(Article)
@@ -1968,7 +1956,7 @@ class AdminViewPermissionsTest(TestCase):
def test_has_module_permission(self):
"""
- Ensure that has_module_permission() returns True for all users who
+ has_module_permission() returns True for all users who
have any permission for that module (add, change, or delete), so that
the module is displayed on the admin index page.
"""
@@ -1997,9 +1985,8 @@ class AdminViewPermissionsTest(TestCase):
def test_overriding_has_module_permission(self):
"""
- Ensure that overriding has_module_permission() has the desired effect.
- In this case, it always returns False, so the module should not be
- displayed on the admin index page for any users.
+ If has_module_permission() always returns False, the module shouldn't
+ be displayed on the admin index page for any users.
"""
articles = Article._meta.verbose_name_plural.title()
sections = Section._meta.verbose_name_plural.title()
@@ -2438,9 +2425,6 @@ class SecureViewTests(TestCase):
"""
def test_secure_view_shows_login_if_not_logged_in(self):
- """
- Ensure that we see the admin login form.
- """
secure_url = reverse('secure_view')
response = self.client.get(secure_url)
self.assertRedirects(response, '%s?next=%s' % (reverse('admin:login'), secure_url))
@@ -2450,7 +2434,7 @@ class SecureViewTests(TestCase):
def test_staff_member_required_decorator_works_with_argument(self):
"""
- Ensure that staff_member_required decorator works with an argument
+ Staff_member_required decorator works with an argument
(redirect_field_name).
"""
secure_url = '/test_admin/admin/secure-view2/'
@@ -2518,7 +2502,7 @@ class AdminViewUnicodeTest(TestCase):
def test_unicode_delete(self):
"""
- Ensure that the delete_view handles non-ASCII characters
+ The delete_view handles non-ASCII characters
"""
delete_dict = {'post': 'yes'}
delete_url = reverse('admin:admin_views_book_delete', args=(self.b1.pk,))
@@ -2664,9 +2648,10 @@ class AdminViewListEditable(TestCase):
self.assertIs(Person.objects.get(name="John Mauchly").alive, False)
def test_non_field_errors(self):
- ''' Ensure that non field errors are displayed for each of the
- forms in the changelist's formset. Refs #13126.
- '''
+ """
+ Non-field errors are displayed for each of the forms in the
+ changelist's formset.
+ """
fd1 = FoodDelivery.objects.create(reference='123', driver='bill', restaurant='thai')
fd2 = FoodDelivery.objects.create(reference='456', driver='bill', restaurant='india')
fd3 = FoodDelivery.objects.create(reference='789', driver='bill', restaurant='pizza')
@@ -2747,7 +2732,7 @@ class AdminViewListEditable(TestCase):
"form-0-alive": "1",
"form-0-gender": "2",
- # Ensure that the form processing understands this as a list_editable "Save"
+ # The form processing understands this as a list_editable "Save"
# and not an action "Go".
"_save": "Save",
}
@@ -2802,7 +2787,7 @@ class AdminViewListEditable(TestCase):
"form-3-id": "4",
"form-3-collector": "1",
- # Ensure that the form processing understands this as a list_editable "Save"
+ # The form processing understands this as a list_editable "Save"
# and not an action "Go".
"_save": "Save",
}
@@ -2810,7 +2795,7 @@ class AdminViewListEditable(TestCase):
# Successful post will redirect
self.assertEqual(response.status_code, 302)
- # Check that the order values have been applied to the right objects
+ # The order values have been applied to the right objects
self.assertEqual(Category.objects.get(id=1).order, 14)
self.assertEqual(Category.objects.get(id=2).order, 13)
self.assertEqual(Category.objects.get(id=3).order, 1)
@@ -2818,8 +2803,7 @@ class AdminViewListEditable(TestCase):
def test_list_editable_pagination(self):
"""
- Ensure that pagination works for list_editable items.
- Refs #16819.
+ Pagination works for list_editable items.
"""
UnorderedObject.objects.create(id=1, name='Unordered object #1')
UnorderedObject.objects.create(id=2, name='Unordered object #2')
@@ -2897,11 +2881,10 @@ class AdminViewListEditable(TestCase):
self.assertEqual(response.context['cl'].list_editable, ())
def test_pk_hidden_fields(self):
- """ Ensure that hidden pk fields aren't displayed in the table body and
- that their corresponding human-readable value is displayed instead.
- Note that the hidden pk fields are in fact be displayed but
- separately (not in the table), and only once.
- Refs #12475.
+ """
+ hidden pk fields aren't displayed in the table body and their
+ corresponding human-readable value is displayed instead. The hidden pk
+ fields are displayed but separately (not in the table) and only once.
"""
story1 = Story.objects.create(title='The adventures of Guido', content='Once upon a time in Djangoland...')
story2 = Story.objects.create(
@@ -2991,15 +2974,15 @@ class AdminSearchTest(TestCase):
self.client.force_login(self.superuser)
def test_search_on_sibling_models(self):
- "Check that a search that mentions sibling models"
+ "A search that mentions sibling models"
response = self.client.get(reverse('admin:admin_views_recommendation_changelist') + '?q=bar')
# confirm the search returned 1 object
self.assertContains(response, "\n1 recommendation\n")
def test_with_fk_to_field(self):
"""
- Ensure that the to_field GET parameter is preserved when a search
- is performed. Refs #10918.
+ The to_field GET parameter is preserved when a search is performed.
+ Refs #10918.
"""
response = self.client.get(reverse('admin:auth_user_changelist') + '?q=joe&%s=id' % TO_FIELD_VAR)
self.assertContains(response, "\n1 user\n")
@@ -3082,7 +3065,9 @@ class AdminInheritedInlinesTest(TestCase):
self.client.force_login(self.superuser)
def test_inline(self):
- "Ensure that inline models which inherit from a common parent are correctly handled by admin."
+ """
+ Inline models which inherit from a common parent are correctly handled.
+ """
foo_user = "foo username"
bar_user = "bar username"
@@ -3300,8 +3285,8 @@ class AdminActionsTest(TestCase):
def test_default_redirect(self):
"""
- Test that actions which don't return an HttpResponse are redirected to
- the same page, retaining the querystring (which may contain changelist
+ Actions which don't return an HttpResponse are redirected to the same
+ page, retaining the querystring (which may contain changelist
information).
"""
action_data = {
@@ -3338,8 +3323,7 @@ class AdminActionsTest(TestCase):
def test_actions_ordering(self):
"""
- Ensure that actions are ordered as expected.
- Refs #15964.
+ Actions are ordered as expected.
"""
response = self.client.get(reverse('admin:admin_views_externalsubscriber_changelist'))
self.assertContains(response, '''
def test_custom_empty_values(self):
"""
- Test that form fields can customize what is considered as an empty value
+ Form fields can customize what is considered as an empty value
for themselves (#19997).
"""
class CustomJSONField(CharField):
diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py
index 792d811f4c..724c16c4fa 100644
--- a/tests/forms_tests/tests/test_formsets.py
+++ b/tests/forms_tests/tests/test_formsets.py
@@ -128,7 +128,7 @@ class FormsFormsetTestCase(SimpleTestCase):
def test_form_kwargs_formset(self):
"""
- Test that custom kwargs set on the formset instance are passed to the
+ Custom kwargs set on the formset instance are passed to the
underlying forms.
"""
FormSet = formset_factory(CustomKwargForm, extra=2)
@@ -139,7 +139,7 @@ class FormsFormsetTestCase(SimpleTestCase):
def test_form_kwargs_formset_dynamic(self):
"""
- Test that form kwargs can be passed dynamically in a formset.
+ Form kwargs can be passed dynamically in a formset.
"""
class DynamicBaseFormSet(BaseFormSet):
def get_form_kwargs(self, index):
@@ -856,8 +856,7 @@ class FormsFormsetTestCase(SimpleTestCase):
"""
)
- # Ensure that max_num has no effect when extra is less than max_num.
-
+ # max_num has no effect when extra is less than max_num.
LimitedFavoriteDrinkFormSet = formset_factory(FavoriteDrinkForm, extra=1, max_num=2)
formset = LimitedFavoriteDrinkFormSet()
form_output = []
@@ -1342,7 +1341,7 @@ class TestIsBoundBehavior(SimpleTestCase):
class TestEmptyFormSet(SimpleTestCase):
def test_empty_formset_is_valid(self):
- """Test that an empty formset still calls clean()"""
+ """An empty formset still calls clean()"""
EmptyFsetWontValidateFormset = formset_factory(FavoriteDrinkForm, extra=0, formset=EmptyFsetWontValidate)
formset = EmptyFsetWontValidateFormset(
data={'form-INITIAL_FORMS': '0', 'form-TOTAL_FORMS': '0'},
diff --git a/tests/forms_tests/tests/test_input_formats.py b/tests/forms_tests/tests/test_input_formats.py
index d0f7fac45a..690a338f4e 100644
--- a/tests/forms_tests/tests/test_input_formats.py
+++ b/tests/forms_tests/tests/test_input_formats.py
@@ -26,7 +26,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13:30:05')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip
+ # The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '13:30:05')
@@ -34,7 +34,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13:30')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@@ -53,7 +53,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13:30:05')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '13:30:05')
@@ -61,7 +61,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13:30')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@@ -78,7 +78,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13.30.05')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@@ -86,7 +86,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13.30')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@@ -103,7 +103,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13.30.05')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@@ -111,7 +111,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13.30')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@@ -129,7 +129,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30:05 PM')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip
+ # The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '01:30:05 PM')
@@ -137,7 +137,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30 PM')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM")
@@ -152,7 +152,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30:05 PM')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '01:30:05 PM')
@@ -160,7 +160,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('01:30 PM')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM")
@@ -177,7 +177,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('13.30.05')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:05 PM")
@@ -185,7 +185,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('13.30')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM")
@@ -202,7 +202,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('13.30.05')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:05 PM")
@@ -210,7 +210,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('13.30')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM")
@@ -227,7 +227,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('13:30:05')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@@ -235,7 +235,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('13:30')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@@ -250,7 +250,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('13:30:05')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@@ -258,7 +258,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('13:30')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@@ -273,7 +273,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('1:30:05 PM')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@@ -281,7 +281,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('1:30 PM')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@@ -296,7 +296,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('1:30:05 PM')
self.assertEqual(result, time(13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@@ -304,7 +304,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('1:30 PM')
self.assertEqual(result, time(13, 30, 0))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@@ -331,7 +331,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip
+ # The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010')
@@ -339,7 +339,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('21.12.10')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -354,7 +354,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010')
@@ -362,7 +362,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('21.12.10')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -381,7 +381,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -389,7 +389,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('12-21-2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -408,7 +408,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -416,7 +416,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('12-21-2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -434,7 +434,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip
+ # The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010')
@@ -442,7 +442,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('21-12-2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -457,7 +457,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010')
@@ -465,7 +465,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('21-12-2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -482,7 +482,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -490,7 +490,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('12-21-2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -507,7 +507,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -515,7 +515,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('12-21-2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@@ -532,7 +532,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('2010-12-21')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@@ -540,7 +540,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('12/21/2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@@ -555,7 +555,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('2010-12-21')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@@ -563,7 +563,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('12/21/2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@@ -578,7 +578,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@@ -586,7 +586,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('21-12-2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@@ -601,7 +601,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@@ -609,7 +609,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('21-12-2010')
self.assertEqual(result, date(2010, 12, 21))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@@ -636,7 +636,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('21.12.2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip
+ # The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010 13:30:05')
@@ -644,7 +644,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('21.12.2010 13:30')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:00")
@@ -659,7 +659,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('21.12.2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010 13:30:05')
@@ -667,7 +667,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('21.12.2010 13:30')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:00")
@@ -686,7 +686,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('13.30.05 12.21.2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:05")
@@ -694,7 +694,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('13.30 12-21-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:00")
@@ -713,7 +713,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('13.30.05 12.21.2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:05")
@@ -721,7 +721,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('13.30 12-21-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:00")
@@ -739,7 +739,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30:05 PM 21/12/2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip
+ # The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '01:30:05 PM 21/12/2010')
@@ -747,7 +747,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30 PM 21-12-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM 21/12/2010")
@@ -762,7 +762,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30:05 PM 21/12/2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '01:30:05 PM 21/12/2010')
@@ -770,7 +770,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30 PM 21-12-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM 21/12/2010")
@@ -787,7 +787,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:05 PM 21/12/2010")
@@ -795,7 +795,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('12-21-2010 13:30')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM 21/12/2010")
@@ -812,7 +812,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:05 PM 21/12/2010")
@@ -820,7 +820,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('12-21-2010 13:30')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM 21/12/2010")
@@ -837,7 +837,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('2010-12-21 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@@ -845,7 +845,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('12/21/2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@@ -860,7 +860,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('2010-12-21 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@@ -868,7 +868,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('12/21/2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@@ -883,7 +883,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('1:30:05 PM 21.12.2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@@ -891,7 +891,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('1:30 PM 21-12-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:00")
@@ -906,7 +906,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('1:30:05 PM 21.12.2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
- # Check that the parsed result does a round trip to the same format
+ # The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@@ -914,6 +914,6 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('1:30 PM 21-12-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
- # Check that the parsed result does a round trip to default format
+ # The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:00")
diff --git a/tests/forms_tests/tests/test_media.py b/tests/forms_tests/tests/test_media.py
index 945d9d059a..d0d226d06e 100644
--- a/tests/forms_tests/tests/test_media.py
+++ b/tests/forms_tests/tests/test_media.py
@@ -126,7 +126,7 @@ class FormsMediaTestCase(SimpleTestCase):
"""
)
- # Check that media addition hasn't affected the original objects
+ # media addition hasn't affected the original objects
self.assertEqual(
str(w1.media),
"""
diff --git a/tests/forms_tests/tests/test_utils.py b/tests/forms_tests/tests/test_utils.py
index 9104d235dd..a6a2d81b9f 100644
--- a/tests/forms_tests/tests/test_utils.py
+++ b/tests/forms_tests/tests/test_utils.py
@@ -38,7 +38,7 @@ class FormsUtilsTestCase(SimpleTestCase):
def test_flatatt_no_side_effects(self):
"""
- Fixes #23883 -- Check that flatatt does not modify the dict passed in
+ flatatt() does not modify the dict passed in.
"""
attrs = {'foo': 'bar', 'true': True, 'false': False}
attrs_copy = copy.copy(attrs)
diff --git a/tests/forms_tests/tests/test_widgets.py b/tests/forms_tests/tests/test_widgets.py
index fadb786c3b..7ea2b35266 100644
--- a/tests/forms_tests/tests/test_widgets.py
+++ b/tests/forms_tests/tests/test_widgets.py
@@ -184,7 +184,7 @@ class LiveWidgetTests(AdminSeleniumTestCase):
def test_textarea_trailing_newlines(self):
"""
- Test that a roundtrip on a ModelForm doesn't alter the TextField value
+ A roundtrip on a ModelForm doesn't alter the TextField value
"""
article = Article.objects.create(content="\nTst\n")
self.selenium.get(self.live_server_url + reverse('article_form', args=[article.pk]))
diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py
index 81a6feef2a..c19d1a66cd 100644
--- a/tests/forms_tests/tests/tests.py
+++ b/tests/forms_tests/tests/tests.py
@@ -80,14 +80,14 @@ class TestModelChoiceField(TestCase):
class TestTicket14567(TestCase):
"""
- Check that the return values of ModelMultipleChoiceFields are QuerySets
+ The return values of ModelMultipleChoiceFields are QuerySets
"""
def test_empty_queryset_return(self):
"If a model's ManyToManyField has blank=True and is saved with no data, a queryset is returned."
option = ChoiceOptionModel.objects.create(name='default')
form = OptionalMultiChoiceModelForm({'multi_choice_optional': '', 'multi_choice': [option.pk]})
self.assertTrue(form.is_valid())
- # Check that the empty value is a QuerySet
+ # The empty value is a QuerySet
self.assertIsInstance(form.cleaned_data['multi_choice_optional'], models.query.QuerySet)
# While we're at it, test whether a QuerySet is returned if there *is* a value.
self.assertIsInstance(form.cleaned_data['multi_choice'], models.query.QuerySet)
@@ -330,7 +330,7 @@ class EmptyLabelTestCase(TestCase):
)
def test_save_empty_label_forms(self):
- # Test that saving a form with a blank choice results in the expected
+ # Saving a form with a blank choice results in the expected
# value being stored in the database.
tests = [
(EmptyCharLabelNoneChoiceForm, 'choice_string_w_none', None),
diff --git a/tests/forms_tests/widget_tests/test_nullbooleanselect.py b/tests/forms_tests/widget_tests/test_nullbooleanselect.py
index b9d55200c5..779a88893f 100644
--- a/tests/forms_tests/widget_tests/test_nullbooleanselect.py
+++ b/tests/forms_tests/widget_tests/test_nullbooleanselect.py
@@ -47,8 +47,7 @@ class NullBooleanSelectTest(WidgetTest):
@override_settings(USE_L10N=True)
def test_l10n(self):
"""
- Ensure that the NullBooleanSelect widget's options are lazily
- localized (#17190).
+ The NullBooleanSelect widget's options are lazily localized (#17190).
"""
widget = NullBooleanSelect()
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py
index 936a76398f..e1debb9d85 100644
--- a/tests/generic_inline_admin/tests.py
+++ b/tests/generic_inline_admin/tests.py
@@ -422,7 +422,7 @@ class GenericInlineModelAdminTest(SimpleTestCase):
def test_custom_form_meta_exclude_with_readonly(self):
"""
- Ensure that the custom ModelForm's `Meta.exclude` is respected when
+ The custom ModelForm's `Meta.exclude` is respected when
used in conjunction with `GenericInlineModelAdmin.readonly_fields`
and when no `ModelAdmin.exclude` is defined.
"""
@@ -449,7 +449,7 @@ class GenericInlineModelAdminTest(SimpleTestCase):
def test_custom_form_meta_exclude(self):
"""
- Ensure that the custom ModelForm's `Meta.exclude` is respected by
+ The custom ModelForm's `Meta.exclude` is respected by
`GenericInlineModelAdmin.get_formset`, and overridden if
`ModelAdmin.exclude` or `GenericInlineModelAdmin.exclude` are defined.
Refs #15907.
@@ -494,7 +494,7 @@ class GenericInlineModelAdminTest(SimpleTestCase):
['description', 'keywords', 'id', 'DELETE'])
def test_get_fieldsets(self):
- # Test that get_fieldsets is called when figuring out form fields.
+ # get_fieldsets is called when figuring out form fields.
# Refs #18681.
class MediaForm(ModelForm):
class Meta:
@@ -515,7 +515,7 @@ class GenericInlineModelAdminTest(SimpleTestCase):
def test_get_formsets_with_inlines_returns_tuples(self):
"""
- Ensure that get_formsets_with_inlines() returns the correct tuples.
+ get_formsets_with_inlines() returns the correct tuples.
"""
class MediaForm(ModelForm):
class Meta:
diff --git a/tests/generic_relations/tests.py b/tests/generic_relations/tests.py
index ca029c6050..540c3456f2 100644
--- a/tests/generic_relations/tests.py
+++ b/tests/generic_relations/tests.py
@@ -327,9 +327,9 @@ class GenericRelationsTests(TestCase):
self.assertQuerysetEqual(bacon.tags.all(), [])
def test_assign_with_queryset(self):
- # Ensure that querysets used in reverse GFK assignments are pre-evaluated
- # so their value isn't affected by the clearing operation in
- # ManyRelatedManager.set() (#19816).
+ # Querysets used in reverse GFK assignments are pre-evaluated so their
+ # value isn't affected by the clearing operation
+ # in ManyRelatedManager.set() (#19816).
bacon = Vegetable.objects.create(name="Bacon", is_yucky=False)
bacon.tags.create(tag="fatty")
bacon.tags.create(tag="salty")
@@ -342,8 +342,7 @@ class GenericRelationsTests(TestCase):
self.assertEqual(1, qs.count())
def test_generic_relation_related_name_default(self):
- # Test that GenericRelation by default isn't usable from
- # the reverse side.
+ # GenericRelation isn't usable from the reverse side by default.
with self.assertRaises(FieldError):
TaggedItem.objects.filter(vegetable__isnull=True)
@@ -489,7 +488,7 @@ id="id_generic_relations-taggeditem-content_type-object_id-1-id" />""" % tag
def test_subclasses_with_gen_rel(self):
"""
- Test that concrete model subclasses with generic relations work
+ Concrete model subclasses with generic relations work
correctly (ticket 11263).
"""
granite = Rock.objects.create(name='granite', hardness=5)
diff --git a/tests/generic_relations_regress/tests.py b/tests/generic_relations_regress/tests.py
index 8eaf1150a7..e3d1399706 100644
--- a/tests/generic_relations_regress/tests.py
+++ b/tests/generic_relations_regress/tests.py
@@ -15,10 +15,8 @@ class GenericRelationTests(TestCase):
def test_inherited_models_content_type(self):
"""
- Test that GenericRelations on inherited classes use the correct content
- type.
+ GenericRelations on inherited classes use the correct content type.
"""
-
p = Place.objects.create(name="South Park")
r = Restaurant.objects.create(name="Chubby's")
l1 = Link.objects.create(content_object=p)
@@ -28,7 +26,7 @@ class GenericRelationTests(TestCase):
def test_reverse_relation_pk(self):
"""
- Test that the correct column name is used for the primary key on the
+ The correct column name is used for the primary key on the
originating model of a query. See #12664.
"""
p = Person.objects.create(account=23, name='Chef')
@@ -52,10 +50,8 @@ class GenericRelationTests(TestCase):
def test_q_object_or(self):
"""
- Tests that SQL query parameters for generic relations are properly
- grouped when OR is used.
-
- Test for bug http://code.djangoproject.com/ticket/11535
+ SQL query parameters for generic relations are properly
+ grouped when OR is used (#11535).
In this bug the first query (below) works while the second, with the
query parameters the same but in reverse order, does not.
@@ -88,7 +84,7 @@ class GenericRelationTests(TestCase):
def test_generic_relation_ordering(self):
"""
- Test that ordering over a generic relation does not include extraneous
+ Ordering over a generic relation does not include extraneous
duplicate results, nor excludes rows not participating in the relation.
"""
p1 = Place.objects.create(name="South Park")
diff --git a/tests/generic_views/test_base.py b/tests/generic_views/test_base.py
index db4ef604fa..a667a4e495 100644
--- a/tests/generic_views/test_base.py
+++ b/tests/generic_views/test_base.py
@@ -76,14 +76,14 @@ class ViewTest(unittest.TestCase):
def test_no_init_kwargs(self):
"""
- Test that a view can't be accidentally instantiated before deployment
+ A view can't be accidentally instantiated before deployment
"""
with self.assertRaises(AttributeError):
SimpleView(key='value').as_view()
def test_no_init_args(self):
"""
- Test that a view can't be accidentally instantiated before deployment
+ A view can't be accidentally instantiated before deployment
"""
with self.assertRaises(TypeError):
SimpleView.as_view('value')
@@ -133,7 +133,7 @@ class ViewTest(unittest.TestCase):
def test_invalid_keyword_argument(self):
"""
- Test that view arguments must be predefined on the class and can't
+ View arguments must be predefined on the class and can't
be named like a HTTP method.
"""
# Check each of the allowed method names
@@ -158,7 +158,7 @@ class ViewTest(unittest.TestCase):
def test_class_attributes(self):
"""
- Test that the callable returned from as_view() has proper
+ The callable returned from as_view() has proper
docstring, name and module.
"""
self.assertEqual(SimpleView.__doc__, SimpleView.as_view().__doc__)
@@ -167,14 +167,14 @@ class ViewTest(unittest.TestCase):
def test_dispatch_decoration(self):
"""
- Test that attributes set by decorators on the dispatch method
+ Attributes set by decorators on the dispatch method
are also present on the closure.
"""
self.assertTrue(DecoratedDispatchView.as_view().is_decorated)
def test_options(self):
"""
- Test that views respond to HTTP OPTIONS requests with an Allow header
+ Views respond to HTTP OPTIONS requests with an Allow header
appropriate for the methods implemented by the view class.
"""
request = self.rf.options('/')
@@ -185,7 +185,7 @@ class ViewTest(unittest.TestCase):
def test_options_for_get_view(self):
"""
- Test that a view implementing GET allows GET and HEAD.
+ A view implementing GET allows GET and HEAD.
"""
request = self.rf.options('/')
view = SimpleView.as_view()
@@ -194,7 +194,7 @@ class ViewTest(unittest.TestCase):
def test_options_for_get_and_post_view(self):
"""
- Test that a view implementing GET and POST allows GET, HEAD, and POST.
+ A view implementing GET and POST allows GET, HEAD, and POST.
"""
request = self.rf.options('/')
view = SimplePostView.as_view()
@@ -203,7 +203,7 @@ class ViewTest(unittest.TestCase):
def test_options_for_post_view(self):
"""
- Test that a view implementing POST allows POST.
+ A view implementing POST allows POST.
"""
request = self.rf.options('/')
view = PostOnlyView.as_view()
diff --git a/tests/generic_views/test_dates.py b/tests/generic_views/test_dates.py
index af7a04c9a6..9b7c20ec73 100644
--- a/tests/generic_views/test_dates.py
+++ b/tests/generic_views/test_dates.py
@@ -670,9 +670,8 @@ class DateDetailViewTests(TestDataMixin, TestCase):
def test_get_object_custom_queryset(self):
"""
- Ensure that custom querysets are used when provided to
- BaseDateDetailView.get_object()
- Refs #16918.
+ Custom querysets are used when provided to
+ BaseDateDetailView.get_object().
"""
res = self.client.get(
'/dates/books/get_object_custom_queryset/2006/may/01/%s/' % self.book2.pk)
diff --git a/tests/generic_views/test_list.py b/tests/generic_views/test_list.py
index 81993eaac0..5a22abd33b 100644
--- a/tests/generic_views/test_list.py
+++ b/tests/generic_views/test_list.py
@@ -59,7 +59,7 @@ class ListViewTests(TestCase):
self.assertEqual(list(res.context['author_list'])[-1].name, 'Author 29')
def test_paginated_queryset_shortdata(self):
- # Test that short datasets ALSO result in a paginated view.
+ # Short datasets also result in a paginated view.
res = self.client.get('/list/authors/paginated/')
self.assertEqual(res.status_code, 200)
self.assertTemplateUsed(res, 'generic_views/author_list.html')
diff --git a/tests/get_earliest_or_latest/tests.py b/tests/get_earliest_or_latest/tests.py
index 27c3c34723..56d48d0710 100644
--- a/tests/get_earliest_or_latest/tests.py
+++ b/tests/get_earliest_or_latest/tests.py
@@ -51,11 +51,11 @@ class EarliestOrLatestTests(TestCase):
self.assertEqual(Article.objects.filter(
pub_date__gt=datetime(2005, 7, 26)).earliest('expire_date'), a2)
- # Ensure that earliest() overrides any other ordering specified on the
- # query. Refs #11283.
+ # earliest() overrides any other ordering specified on the query.
+ # Refs #11283.
self.assertEqual(Article.objects.order_by('id').earliest(), a1)
- # Ensure that error is raised if the user forgot to add a get_latest_by
+ # Error is raised if the user forgot to add a get_latest_by
# in the Model.Meta
Article.objects.model._meta.get_latest_by = None
with self.assertRaisesMessage(
@@ -103,11 +103,10 @@ class EarliestOrLatestTests(TestCase):
a3,
)
- # Ensure that latest() overrides any other ordering specified on the query. Refs #11283.
+ # latest() overrides any other ordering specified on the query (#11283).
self.assertEqual(Article.objects.order_by('id').latest(), a4)
- # Ensure that error is raised if the user forgot to add a get_latest_by
- # in the Model.Meta
+ # Error is raised if get_latest_by isn't in Model.Meta.
Article.objects.model._meta.get_latest_by = None
with self.assertRaisesMessage(
AssertionError,
@@ -131,33 +130,19 @@ class TestFirstLast(TestCase):
def test_first(self):
p1 = Person.objects.create(name="Bob", birthday=datetime(1950, 1, 1))
p2 = Person.objects.create(name="Alice", birthday=datetime(1961, 2, 3))
- self.assertEqual(
- Person.objects.first(), p1)
- self.assertEqual(
- Person.objects.order_by('name').first(), p2)
- self.assertEqual(
- Person.objects.filter(birthday__lte=datetime(1955, 1, 1)).first(),
- p1)
- self.assertIs(
- Person.objects.filter(birthday__lte=datetime(1940, 1, 1)).first(),
- None)
+ self.assertEqual(Person.objects.first(), p1)
+ self.assertEqual(Person.objects.order_by('name').first(), p2)
+ self.assertEqual(Person.objects.filter(birthday__lte=datetime(1955, 1, 1)).first(), p1)
+ self.assertIsNone(Person.objects.filter(birthday__lte=datetime(1940, 1, 1)).first())
def test_last(self):
- p1 = Person.objects.create(
- name="Alice", birthday=datetime(1950, 1, 1))
- p2 = Person.objects.create(
- name="Bob", birthday=datetime(1960, 2, 3))
+ p1 = Person.objects.create(name="Alice", birthday=datetime(1950, 1, 1))
+ p2 = Person.objects.create(name="Bob", birthday=datetime(1960, 2, 3))
# Note: by default PK ordering.
- self.assertEqual(
- Person.objects.last(), p2)
- self.assertEqual(
- Person.objects.order_by('-name').last(), p1)
- self.assertEqual(
- Person.objects.filter(birthday__lte=datetime(1955, 1, 1)).last(),
- p1)
- self.assertIs(
- Person.objects.filter(birthday__lte=datetime(1940, 1, 1)).last(),
- None)
+ self.assertEqual(Person.objects.last(), p2)
+ self.assertEqual(Person.objects.order_by('-name').last(), p1)
+ self.assertEqual(Person.objects.filter(birthday__lte=datetime(1955, 1, 1)).last(), p1)
+ self.assertIsNone(Person.objects.filter(birthday__lte=datetime(1940, 1, 1)).last())
def test_index_error_not_suppressed(self):
"""
diff --git a/tests/gis_tests/gdal_tests/test_raster.py b/tests/gis_tests/gdal_tests/test_raster.py
index 8137aeaeb0..53f1bf985a 100644
--- a/tests/gis_tests/gdal_tests/test_raster.py
+++ b/tests/gis_tests/gdal_tests/test_raster.py
@@ -345,7 +345,7 @@ class GDALBandTests(SimpleTestCase):
self.assertAlmostEqual(self.band.mean, 2.828326634228898)
self.assertAlmostEqual(self.band.std, 2.4260526986669095)
- # Check that statistics are persisted into PAM file on band close
+ # Statistics are persisted into PAM file on band close
self.band = None
self.assertTrue(os.path.isfile(pam_file))
finally:
diff --git a/tests/gis_tests/geoadmin/tests.py b/tests/gis_tests/geoadmin/tests.py
index 2658ef32e8..88c3934020 100644
--- a/tests/gis_tests/geoadmin/tests.py
+++ b/tests/gis_tests/geoadmin/tests.py
@@ -55,7 +55,7 @@ class GeoAdminTest(TestCase):
def test_olwidget_has_changed(self):
"""
- Check that changes are accurately noticed by OpenLayersWidget.
+ Changes are accurately noticed by OpenLayersWidget.
"""
geoadmin = site._registry[City]
form = geoadmin.get_changelist_form(None)()
diff --git a/tests/gis_tests/geoapp/tests.py b/tests/gis_tests/geoapp/tests.py
index cb7d9bd884..d64ab24b4c 100644
--- a/tests/gis_tests/geoapp/tests.py
+++ b/tests/gis_tests/geoapp/tests.py
@@ -877,7 +877,7 @@ class GeoQuerySetTest(TestCase):
def test_within_subquery(self):
"""
- Test that using a queryset inside a geo lookup is working (using a subquery)
+ Using a queryset inside a geo lookup is working (using a subquery)
(#14483).
"""
tex_cities = City.objects.filter(
diff --git a/tests/gis_tests/gis_migrations/test_commands.py b/tests/gis_tests/gis_migrations/test_commands.py
index b9efc2c39c..65bd035b8c 100644
--- a/tests/gis_tests/gis_migrations/test_commands.py
+++ b/tests/gis_tests/gis_migrations/test_commands.py
@@ -27,15 +27,13 @@ class MigrateTests(TransactionTestCase):
def test_migrate_gis(self):
"""
Tests basic usage of the migrate command when a model uses Geodjango
- fields. Regression test for ticket #22001:
- https://code.djangoproject.com/ticket/22001
+ fields (#22001).
It's also used to showcase an error in migrations where spatialite is
enabled and geo tables are renamed resulting in unique constraint
- failure on geometry_columns. Regression for ticket #23030:
- https://code.djangoproject.com/ticket/23030
+ failure on geometry_columns (#23030).
"""
- # Make sure the right tables exist
+ # The right tables exist
self.assertTableExists("gis_migrations_neighborhood")
self.assertTableExists("gis_migrations_household")
self.assertTableExists("gis_migrations_family")
@@ -43,7 +41,7 @@ class MigrateTests(TransactionTestCase):
self.assertTableExists("gis_migrations_heatmap")
# Unmigrate everything
call_command("migrate", "gis_migrations", "zero", verbosity=0)
- # Make sure it's all gone
+ # All tables are gone
self.assertTableNotExists("gis_migrations_neighborhood")
self.assertTableNotExists("gis_migrations_household")
self.assertTableNotExists("gis_migrations_family")
diff --git a/tests/gis_tests/layermap/tests.py b/tests/gis_tests/layermap/tests.py
index c57ba47f32..a8a352eda5 100644
--- a/tests/gis_tests/layermap/tests.py
+++ b/tests/gis_tests/layermap/tests.py
@@ -304,7 +304,7 @@ class LayerMapTest(TestCase):
lm.save(silent=True, strict=True)
def test_textfield(self):
- "Tests that String content fits also in a TextField"
+ "String content fits also in a TextField"
mapping = copy(city_mapping)
mapping['name_txt'] = 'Name'
lm = LayerMapping(City, city_shp, mapping)
diff --git a/tests/gis_tests/test_geoforms.py b/tests/gis_tests/test_geoforms.py
index f4b6e299b5..8c6bc2a56a 100644
--- a/tests/gis_tests/test_geoforms.py
+++ b/tests/gis_tests/test_geoforms.py
@@ -369,5 +369,4 @@ class CustomGeometryWidgetTest(SimpleTestCase):
form = PointForm(data={'p': point.json})
self.assertTrue(form.is_valid())
- # Ensure that resulting geometry has srid set
self.assertEqual(form.cleaned_data['p'].srid, 4326)
diff --git a/tests/gis_tests/tests.py b/tests/gis_tests/tests.py
index 1ee3a56a16..65526d0cb8 100644
--- a/tests/gis_tests/tests.py
+++ b/tests/gis_tests/tests.py
@@ -47,9 +47,9 @@ if HAS_POSTGRES:
@unittest.skipUnless(HAS_POSTGRES, "The psycopg2 driver is needed for these tests")
-class TestPostgisVersionCheck(unittest.TestCase):
+class TestPostGISVersionCheck(unittest.TestCase):
"""
- Tests that the postgis version check parses correctly the version numbers
+ The PostGIS version check parses correctly the version numbers
"""
def test_get_version(self):
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py
index ea7a5ba130..a420917421 100644
--- a/tests/handlers/tests.py
+++ b/tests/handlers/tests.py
@@ -46,7 +46,7 @@ class HandlerTests(SimpleTestCase):
def test_non_ascii_query_string(self):
"""
- Test that non-ASCII query strings are properly decoded (#20530, #22996).
+ Non-ASCII query strings are properly decoded (#20530, #22996).
"""
environ = RequestFactory().get('/').environ
raw_query_strings = [
@@ -71,7 +71,7 @@ class HandlerTests(SimpleTestCase):
self.assertListEqual(got, ['café', 'café', 'caf\ufffd', 'café'])
def test_non_ascii_cookie(self):
- """Test that non-ASCII cookies set in JavaScript are properly decoded (#20557)."""
+ """Non-ASCII cookies set in JavaScript are properly decoded (#20557)."""
environ = RequestFactory().get('/').environ
raw_cookie = 'want="café"'
if six.PY3:
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
index e2201454f0..cde5ca65d2 100644
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -498,14 +498,13 @@ class HttpResponseSubclassesTests(SimpleTestCase):
def test_redirect(self):
response = HttpResponseRedirect('/redirected/')
self.assertEqual(response.status_code, 302)
- # Test that standard HttpResponse init args can be used
+ # Standard HttpResponse init args can be used
response = HttpResponseRedirect(
'/redirected/',
content='The resource has temporarily moved',
content_type='text/html',
)
self.assertContains(response, 'The resource has temporarily moved', status_code=302)
- # Test that url attribute is right
self.assertEqual(response.url, response['Location'])
def test_redirect_lazy(self):
@@ -529,7 +528,7 @@ class HttpResponseSubclassesTests(SimpleTestCase):
def test_not_allowed(self):
response = HttpResponseNotAllowed(['GET'])
self.assertEqual(response.status_code, 405)
- # Test that standard HttpResponse init args can be used
+ # Standard HttpResponse init args can be used
response = HttpResponseNotAllowed(['GET'], content='Only the GET method is allowed', content_type='text/html')
self.assertContains(response, 'Only the GET method is allowed', status_code=405)
@@ -697,18 +696,14 @@ class FileCloseTests(SimpleTestCase):
class CookieTests(unittest.TestCase):
def test_encode(self):
- """
- Test that we don't output tricky characters in encoded value
- """
+ """Semicolons and commas are encoded."""
c = SimpleCookie()
c['test'] = "An,awkward;value"
self.assertNotIn(";", c.output().rstrip(';')) # IE compat
self.assertNotIn(",", c.output().rstrip(';')) # Safari compat
def test_decode(self):
- """
- Test that we can still preserve semi-colons and commas
- """
+ """Semicolons and commas are decoded."""
c = SimpleCookie()
c['test'] = "An,awkward;value"
c2 = SimpleCookie()
@@ -718,9 +713,6 @@ class CookieTests(unittest.TestCase):
self.assertEqual(c['test'].value, c3['test'])
def test_decode_2(self):
- """
- Test that we haven't broken normal encoding
- """
c = SimpleCookie()
c['test'] = b"\xf0"
c2 = SimpleCookie()
@@ -731,13 +723,13 @@ class CookieTests(unittest.TestCase):
def test_nonstandard_keys(self):
"""
- Test that a single non-standard cookie name doesn't affect all cookies. Ticket #13007.
+ A single non-standard cookie name doesn't affect all cookies (#13007).
"""
self.assertIn('good_cookie', parse_cookie('good_cookie=yes;bad:cookie=yes').keys())
def test_repeated_nonstandard_keys(self):
"""
- Test that a repeated non-standard name doesn't affect all cookies. Ticket #15852
+ A repeated non-standard name doesn't affect all cookies (#15852).
"""
self.assertIn('good_cookie', parse_cookie('a:=b; a:=c; good_cookie=yes').keys())
@@ -788,9 +780,6 @@ class CookieTests(unittest.TestCase):
self.assertEqual(parse_cookie(' = b ; ; = ; c = ; '), {'': 'b', 'c': ''})
def test_httponly_after_load(self):
- """
- Test that we can use httponly attribute on cookies that we load
- """
c = SimpleCookie()
c.load("name=val")
c['name']['httponly'] = True
diff --git a/tests/i18n/patterns/tests.py b/tests/i18n/patterns/tests.py
index 613a88701f..6706e32e84 100644
--- a/tests/i18n/patterns/tests.py
+++ b/tests/i18n/patterns/tests.py
@@ -111,8 +111,8 @@ class RequestURLConfTests(SimpleTestCase):
@override_settings(ROOT_URLCONF='i18n.patterns.urls.path_unused')
class PathUnusedTests(URLTestCaseBase):
"""
- Check that if no i18n_patterns is used in root URLconfs, then no
- language activation happens based on url prefix.
+ If no i18n_patterns is used in root URLconfs, then no language activation
+ activation happens based on url prefix.
"""
def test_no_lang_activate(self):
@@ -235,8 +235,7 @@ class URLRedirectTests(URLTestCaseBase):
class URLVaryAcceptLanguageTests(URLTestCaseBase):
"""
- Tests that 'Accept-Language' is not added to the Vary header when using
- prefixed URLs.
+ 'Accept-Language' is not added to the Vary header when using prefixed URLs.
"""
def test_no_prefix_response(self):
response = self.client.get('/not-prefixed/')
diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py
index 414e311db5..708e8475a4 100644
--- a/tests/i18n/test_extraction.py
+++ b/tests/i18n/test_extraction.py
@@ -214,7 +214,7 @@ class BasicExtractorTests(ExtractorTests):
)
with self.assertRaisesMessage(SyntaxError, msg):
management.call_command('makemessages', locale=[LOCALE], extensions=['tpl'], verbosity=0)
- # Check that the temporary file was cleaned up
+ # The temporary file was cleaned up
self.assertFalse(os.path.exists('./templates/template_with_error.tpl.py'))
def test_unicode_decode_error(self):
@@ -237,9 +237,8 @@ class BasicExtractorTests(ExtractorTests):
def test_template_message_context_extractor(self):
"""
- Ensure that message contexts are correctly extracted for the
- {% trans %} and {% blocktrans %} template tags.
- Refs #14806.
+ Message contexts are correctly extracted for the {% trans %} and
+ {% blocktrans %} template tags (#14806).
"""
management.call_command('makemessages', locale=[LOCALE], verbosity=0)
self.assertTrue(os.path.exists(self.PO_FILE))
@@ -350,7 +349,7 @@ class BasicExtractorTests(ExtractorTests):
def test_makemessages_find_files(self):
"""
- Test that find_files only discover files having the proper extensions.
+ find_files only discover files having the proper extensions.
"""
cmd = MakeMessagesCommand()
cmd.ignore_patterns = ['CVS', '.*', '*~', '*.pyc']
@@ -695,9 +694,8 @@ class CustomLayoutExtractionTests(ExtractorTests):
def test_project_locale_paths(self):
"""
- Test that:
- * translations for an app containing a locale folder are stored in that folder
- * translations outside of that app are in LOCALE_PATHS[0]
+ * translations for an app containing a locale folder are stored in that folder
+ * translations outside of that app are in LOCALE_PATHS[0]
"""
with override_settings(LOCALE_PATHS=[os.path.join(self.test_dir, 'project_locale')]):
management.call_command('makemessages', locale=[LOCALE], verbosity=0)
diff --git a/tests/i18n/test_percents.py b/tests/i18n/test_percents.py
index 4d33570774..6e39b59a7f 100644
--- a/tests/i18n/test_percents.py
+++ b/tests/i18n/test_percents.py
@@ -35,7 +35,7 @@ class ExtractingStringsWithPercentSigns(POFileAssertionMixin, FrenchTestCase):
"""
Tests the extracted string found in the gettext catalog.
- Ensures that percent signs are python formatted.
+ Percent signs are python formatted.
These tests should all have an analogous translation tests below, ensuring
the python formatting does not persist through to a rendered template.
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index daba0d34a7..59235c9977 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -107,8 +107,8 @@ class TranslationTests(SimpleTestCase):
def test_override_exit(self):
"""
- Test that the language restored is the one used when the function was
- called, not the one used when the decorator was initialized. refs #23381
+ The language restored is the one used when the function was
+ called, not the one used when the decorator was initialized (#23381).
"""
activate('fr')
@@ -267,9 +267,8 @@ class TranslationTests(SimpleTestCase):
@override_settings(LOCALE_PATHS=extended_locale_paths)
def test_template_tags_pgettext(self):
"""
- Ensure that message contexts are taken into account the {% trans %} and
- {% blocktrans %} template tags.
- Refs #14806.
+ Message contexts are taken into account the {% trans %} and
+ {% blocktrans %} template tags (#14806).
"""
trans_real._active = local()
trans_real._translations = {}
@@ -726,10 +725,9 @@ class FormattingTests(SimpleTestCase):
def test_false_like_locale_formats(self):
"""
- Ensure that the active locale's formats take precedence over the
- default settings even if they would be interpreted as False in a
- conditional test (e.g. 0 or empty string).
- Refs #16938.
+ The active locale's formats take precedence over the default settings
+ even if they would be interpreted as False in a conditional test
+ (e.g. 0 or empty string) (#16938).
"""
with patch_formats('fr', THOUSAND_SEPARATOR='', FIRST_DAY_OF_WEEK=0):
with translation.override('fr'):
@@ -1152,7 +1150,7 @@ class FormattingTests(SimpleTestCase):
with translation.override('ru', deactivate=True):
# Russian locale has non-breaking space (\xa0) as thousand separator
- # Check that usual space is accepted too when sanitizing inputs
+ # Usual space is accepted too when sanitizing inputs
with self.settings(USE_THOUSAND_SEPARATOR=True):
self.assertEqual(sanitize_separators('1\xa0234\xa0567'), '1234567')
self.assertEqual(sanitize_separators('77\xa0777,777'), '77777.777')
@@ -1514,8 +1512,8 @@ class MiscTests(SimpleTestCase):
@override_settings(LOCALE_PATHS=extended_locale_paths)
def test_percent_formatting_in_blocktrans(self):
"""
- Test that using Python's %-formatting is properly escaped in blocktrans,
- singular or plural
+ Python's %-formatting is properly escaped in blocktrans, singular or
+ plural.
"""
t_sing = Template("{% load i18n %}{% blocktrans %}There are %(num_comments)s comments{% endblocktrans %}")
t_plur = Template(
@@ -1531,8 +1529,8 @@ class MiscTests(SimpleTestCase):
def test_cache_resetting(self):
"""
- #14170 after setting LANGUAGE, cache should be cleared and languages
- previously valid should not be used.
+ After setting LANGUAGE, the cache should be cleared and languages
+ previously valid should not be used (#14170).
"""
g = get_language_from_request
r = self.rf.get('/')
@@ -1812,9 +1810,10 @@ class LocaleMiddlewareTests(TestCase):
],
)
def test_language_not_saved_to_session(self):
- """Checks that current language is not automatically saved to
- session on every request."""
- # Regression test for #21473
+ """
+ The Current language isno' automatically saved to the session on every
+ request (#21473).
+ """
self.client.get('/fr/simple/')
self.assertNotIn(LANGUAGE_SESSION_KEY, self.client.session)
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py
index 60942353d9..d1ca549fb0 100644
--- a/tests/inspectdb/tests.py
+++ b/tests/inspectdb/tests.py
@@ -236,7 +236,7 @@ class InspectDBTestCase(TestCase):
self.assertIn("class InspectdbSpecialTableName(models.Model):", output)
def test_managed_models(self):
- """Test that by default the command generates models with `Meta.managed = False` (#14305)"""
+ """By default the command generates models with `Meta.managed = False` (#14305)"""
out = StringIO()
call_command('inspectdb',
table_name_filter=lambda tn: tn.startswith('inspectdb_columntypes'),
diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py
index 7bee998043..369b9b1586 100644
--- a/tests/introspection/tests.py
+++ b/tests/introspection/tests.py
@@ -182,8 +182,7 @@ class IntrospectionTests(TransactionTestCase):
@ignore_warnings(category=RemovedInDjango21Warning)
def test_get_indexes_multicol(self):
"""
- Test that multicolumn indexes are not included in the introspection
- results.
+ Multicolumn indexes are not included in the introspection results.
"""
with connection.cursor() as cursor:
indexes = connection.introspection.get_indexes(cursor, Reporter._meta.db_table)
diff --git a/tests/invalid_models_tests/test_relative_fields.py b/tests/invalid_models_tests/test_relative_fields.py
index 6756302bf1..d178d6936e 100644
--- a/tests/invalid_models_tests/test_relative_fields.py
+++ b/tests/invalid_models_tests/test_relative_fields.py
@@ -1527,7 +1527,7 @@ class ComplexClashTests(SimpleTestCase):
class M2mThroughFieldsTests(SimpleTestCase):
def test_m2m_field_argument_validation(self):
"""
- Tests that ManyToManyField accepts the ``through_fields`` kwarg
+ ManyToManyField accepts the ``through_fields`` kwarg
only if an intermediary table is specified.
"""
class Fan(models.Model):
@@ -1538,7 +1538,7 @@ class M2mThroughFieldsTests(SimpleTestCase):
def test_invalid_order(self):
"""
- Tests that mixing up the order of link fields to ManyToManyField.through_fields
+ Mixing up the order of link fields to ManyToManyField.through_fields
triggers validation errors.
"""
class Fan(models.Model):
@@ -1572,7 +1572,7 @@ class M2mThroughFieldsTests(SimpleTestCase):
def test_invalid_field(self):
"""
- Tests that providing invalid field names to ManyToManyField.through_fields
+ Providing invalid field names to ManyToManyField.through_fields
triggers validation errors.
"""
class Fan(models.Model):
@@ -1610,7 +1610,7 @@ class M2mThroughFieldsTests(SimpleTestCase):
def test_explicit_field_names(self):
"""
- Tests that if ``through_fields`` kwarg is given, it must specify both
+ If ``through_fields`` kwarg is given, it must specify both
link fields of the intermediary table.
"""
class Fan(models.Model):
diff --git a/tests/known_related_objects/models.py b/tests/known_related_objects/models.py
index 69cb26706a..bd8fd1d502 100644
--- a/tests/known_related_objects/models.py
+++ b/tests/known_related_objects/models.py
@@ -1,7 +1,7 @@
"""
Existing related object instance caching.
-Test that queries are not redone when going back through known relations.
+Queries are not redone when going back through known relations.
"""
from django.db import models
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
index 5a65c88497..a46cad2f9a 100644
--- a/tests/logging_tests/tests.py
+++ b/tests/logging_tests/tests.py
@@ -170,7 +170,7 @@ class AdminEmailHandlerTest(SimpleTestCase):
logger = logging.getLogger('django')
def get_admin_email_handler(self, logger):
- # Ensure that AdminEmailHandler does not get filtered out
+ # AdminEmailHandler does not get filtered out
# even with DEBUG=True.
admin_email_handler = [
h for h in logger.handlers
@@ -188,9 +188,8 @@ class AdminEmailHandlerTest(SimpleTestCase):
)
def test_accepts_args(self):
"""
- Ensure that user-supplied arguments and the EMAIL_SUBJECT_PREFIX
- setting are used to compose the email subject.
- Refs #16736.
+ User-supplied arguments and the EMAIL_SUBJECT_PREFIX setting are used
+ to compose the email subject (#16736).
"""
message = "Custom message that says '%s' and '%s'"
token1 = 'ping'
@@ -219,8 +218,7 @@ class AdminEmailHandlerTest(SimpleTestCase):
)
def test_accepts_args_and_request(self):
"""
- Ensure that the subject is also handled if being
- passed a request object.
+ The subject is also handled if being passed a request object.
"""
message = "Custom message that says '%s' and '%s'"
token1 = 'ping'
@@ -255,9 +253,8 @@ class AdminEmailHandlerTest(SimpleTestCase):
)
def test_subject_accepts_newlines(self):
"""
- Ensure that newlines in email reports' subjects are escaped to avoid
- AdminErrorHandler to fail.
- Refs #17281.
+ Newlines in email reports' subjects are escaped to prevent
+ AdminErrorHandler from failing (#17281).
"""
message = 'Message \r\n with newlines'
expected_subject = 'ERROR: Message \\r\\n with newlines'
@@ -361,7 +358,7 @@ class AdminEmailHandlerTest(SimpleTestCase):
class SettingsConfigTest(AdminScriptTestCase):
"""
- Test that accessing settings in a custom logging handler does not trigger
+ Accessing settings in a custom logging handler does not trigger
a circular import error.
"""
def setUp(self):
@@ -393,7 +390,7 @@ dictConfig.called = False
class SetupConfigureLogging(SimpleTestCase):
"""
- Test that calling django.setup() initializes the logging configuration.
+ Calling django.setup() initializes the logging configuration.
"""
@override_settings(LOGGING_CONFIG='logging_tests.tests.dictConfig',
LOGGING=OLD_LOGGING)
@@ -430,7 +427,7 @@ class SecurityLoggerTest(SimpleTestCase):
class SettingsCustomLoggingTest(AdminScriptTestCase):
"""
- Test that using a logging defaults are still applied when using a custom
+ Using a logging defaults are still applied when using a custom
callable in LOGGING_CONFIG (i.e., logging.config.fileConfig).
"""
def setUp(self):
diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py
index 0f5b72f051..1c8dd986fc 100644
--- a/tests/lookup/tests.py
+++ b/tests/lookup/tests.py
@@ -655,29 +655,28 @@ class LookupTests(TestCase):
def test_regex_null(self):
"""
- Ensure that a regex lookup does not fail on null/None values
+ A regex lookup does not fail on null/None values
"""
Season.objects.create(year=2012, gt=None)
self.assertQuerysetEqual(Season.objects.filter(gt__regex=r'^$'), [])
def test_regex_non_string(self):
"""
- Ensure that a regex lookup does not fail on non-string fields
+ A regex lookup does not fail on non-string fields
"""
Season.objects.create(year=2013, gt=444)
self.assertQuerysetEqual(Season.objects.filter(gt__regex=r'^444$'), [''])
def test_regex_non_ascii(self):
"""
- Ensure that a regex lookup does not trip on non-ASCII characters.
+ A regex lookup does not trip on non-ASCII characters.
"""
Player.objects.create(name='\u2660')
Player.objects.get(name__regex='\u2660')
def test_nonfield_lookups(self):
"""
- Ensure that a lookup query containing non-fields raises the proper
- exception.
+ A lookup query containing non-fields raises the proper exception.
"""
with self.assertRaises(FieldError):
Article.objects.filter(headline__blahblah=99)
@@ -688,12 +687,10 @@ class LookupTests(TestCase):
def test_lookup_collision(self):
"""
- Ensure that genuine field names don't collide with built-in lookup
- types ('year', 'gt', 'range', 'in' etc.).
- Refs #11670.
+ Genuine field names don't collide with built-in lookup types
+ ('year', 'gt', 'range', 'in' etc.) (#11670).
"""
-
- # Here we're using 'gt' as a code number for the year, e.g. 111=>2009.
+ # 'gt' is used as a code number for the year, e.g. 111=>2009.
season_2009 = Season.objects.create(year=2009, gt=111)
season_2009.games.create(home="Houston Astros", away="St. Louis Cardinals")
season_2010 = Season.objects.create(year=2010, gt=222)
diff --git a/tests/m2m_recursive/tests.py b/tests/m2m_recursive/tests.py
index 8ab86aaaee..c6573800a8 100644
--- a/tests/m2m_recursive/tests.py
+++ b/tests/m2m_recursive/tests.py
@@ -21,7 +21,6 @@ class RecursiveM2MTests(TestCase):
self.d.friends.add(self.a, self.c)
def test_recursive_m2m_all(self):
- """ Test that m2m relations are reported correctly """
# Who is friends with Anne?
self.assertQuerysetEqual(
self.a.friends.all(), [
@@ -59,8 +58,6 @@ class RecursiveM2MTests(TestCase):
)
def test_recursive_m2m_reverse_add(self):
- """ Test reverse m2m relation is consistent """
-
# Bill is already friends with Anne - add Anne again, but in the
# reverse direction
self.b.friends.add(self.a)
@@ -84,8 +81,6 @@ class RecursiveM2MTests(TestCase):
)
def test_recursive_m2m_remove(self):
- """ Test that we can remove items from an m2m relationship """
-
# Remove Anne from Bill's friends
self.b.friends.remove(self.a)
@@ -104,8 +99,6 @@ class RecursiveM2MTests(TestCase):
)
def test_recursive_m2m_clear(self):
- """ Tests the clear method works as expected on m2m fields """
-
# Clear Anne's group of friends
self.a.friends.clear()
@@ -132,8 +125,6 @@ class RecursiveM2MTests(TestCase):
)
def test_recursive_m2m_add_via_related_name(self):
- """ Tests that we can add m2m relations via the related_name attribute """
-
# David is idolized by Anne and Chuck - add in reverse direction
self.d.stalkers.add(self.a)
@@ -152,8 +143,7 @@ class RecursiveM2MTests(TestCase):
)
def test_recursive_m2m_add_in_both_directions(self):
- """ Check that adding the same relation twice results in a single relation """
-
+ """Adding the same relation twice results in a single relation."""
# Ann idolizes David
self.a.idols.add(self.d)
@@ -173,8 +163,6 @@ class RecursiveM2MTests(TestCase):
self.assertEqual(self.a.idols.all().count(), 1)
def test_recursive_m2m_related_to_self(self):
- """ Check the expected behavior when an instance is related to itself """
-
# Ann idolizes herself
self.a.idols.add(self.a)
diff --git a/tests/m2m_signals/tests.py b/tests/m2m_signals/tests.py
index daaa5c751c..834897eb77 100644
--- a/tests/m2m_signals/tests.py
+++ b/tests/m2m_signals/tests.py
@@ -359,7 +359,7 @@ class ManyToManySignalsTest(TestCase):
self._initialize_signal_car(add_default_parts_before_set_signal=True)
- # Check that signals still work when model inheritance is involved
+ # Signals still work when model inheritance is involved
c4 = SportsCar.objects.create(name='Bugatti', price='1000000')
c4b = Car.objects.get(name='Bugatti')
c4.default_parts.set([self.doors])
diff --git a/tests/m2m_through/tests.py b/tests/m2m_through/tests.py
index 4b995e02b3..47cbbeecda 100644
--- a/tests/m2m_through/tests.py
+++ b/tests/m2m_through/tests.py
@@ -341,7 +341,7 @@ class M2mThroughTests(TestCase):
def test_through_fields(self):
"""
- Tests that relations with intermediary tables with multiple FKs
+ Relations with intermediary tables with multiple FKs
to the M2M's ``to`` model are possible.
"""
event = Event.objects.create(title='Rockwhale 2014')
diff --git a/tests/m2m_through_regress/tests.py b/tests/m2m_through_regress/tests.py
index 26e20fc97d..9464c50b93 100644
--- a/tests/m2m_through_regress/tests.py
+++ b/tests/m2m_through_regress/tests.py
@@ -91,7 +91,10 @@ class M2MThroughTestCase(TestCase):
)
def test_join_trimming_forwards(self):
- "Check that we don't involve too many copies of the intermediate table when doing a join. Refs #8046, #8254"
+ """
+ Too many copies of the intermediate table aren't involved when doing a
+ join (#8046, #8254).
+ """
self.assertQuerysetEqual(
self.rock.members.filter(membership__price=50), [
"",
diff --git a/tests/mail/tests.py b/tests/mail/tests.py
index 51497d71cd..8e7458bc49 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -45,11 +45,11 @@ class HeadersCheckMixin(object):
def assertMessageHasHeaders(self, message, headers):
"""
- Check that :param message: has all :param headers: headers.
+ Asserts that the `message` has all `headers`.
- :param message: can be an instance of an email.Message subclass or a
- string with the contents of an email message.
- :param headers: should be a set of (header-name, header-value) tuples.
+ message: can be an instance of an email.Message subclass or a string
+ with the contents of an email message.
+ headers: should be a set of (header-name, header-value) tuples.
"""
if isinstance(message, binary_type):
message = message_from_bytes(message)
@@ -432,7 +432,6 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
def test_attach_text_as_bytes(self):
msg = EmailMessage('subject', 'body', 'from@example.com', ['to@example.com'])
msg.attach('file.txt', b'file content')
- # Check that the message would be sent at all.
sent_num = msg.send()
self.assertEqual(sent_num, 1)
filename, content, mimetype = self.get_decoded_attachments(msg)[0]
@@ -620,7 +619,7 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
parent_msg.attach(content=child_s, mimetype='message/rfc822')
parent_s = parent_msg.message().as_string()
- # Verify that the child message header is not base64 encoded
+ # The child message header is not base64 encoded
self.assertIn(str('Child Subject'), parent_s)
# Feature test: try attaching email.Message object directly to the mail.
@@ -631,7 +630,7 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
parent_msg.attach(content=child_msg.message(), mimetype='message/rfc822')
parent_s = parent_msg.message().as_string()
- # Verify that the child message header is not base64 encoded
+ # The child message header is not base64 encoded
self.assertIn(str('Child Subject'), parent_s)
# Feature test: try attaching Django's EmailMessage object directly to the mail.
@@ -642,7 +641,7 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
parent_msg.attach(content=child_msg, mimetype='message/rfc822')
parent_s = parent_msg.message().as_string()
- # Verify that the child message header is not base64 encoded
+ # The child message header is not base64 encoded
self.assertIn(str('Child Subject'), parent_s)
def test_sanitize_address(self):
@@ -890,7 +889,7 @@ class BaseEmailBackendTests(HeadersCheckMixin, object):
@override_settings(ADMINS=[], MANAGERS=[])
def test_empty_admins(self):
"""
- Test that mail_admins/mail_managers doesn't connect to the mail server
+ mail_admins/mail_managers doesn't connect to the mail server
if there are no recipients (#9383)
"""
mail_admins('hi', 'there')
@@ -971,14 +970,14 @@ class BaseEmailBackendTests(HeadersCheckMixin, object):
def test_close_connection(self):
"""
- Test that connection can be closed (even when not explicitly opened)
+ Connection can be closed (even when not explicitly opened)
"""
conn = mail.get_connection(username='', password='')
conn.close()
def test_use_as_contextmanager(self):
"""
- Test that the connection can be used as a contextmanager.
+ The connection can be used as a contextmanager.
"""
opened = [False]
closed = [False]
@@ -1114,7 +1113,7 @@ class ConsoleBackendTests(BaseEmailBackendTests, SimpleTestCase):
def test_console_stream_kwarg(self):
"""
- Test that the console backend can be pointed at an arbitrary stream.
+ The console backend can be pointed at an arbitrary stream.
"""
s = StringIO()
connection = mail.get_connection('django.core.mail.backends.console.EmailBackend', stream=s)
@@ -1300,7 +1299,7 @@ class SMTPBackendTests(BaseEmailBackendTests, SMTPBackendTestsBase):
def test_auth_attempted(self):
"""
- Test that opening the backend with non empty username/password tries
+ Opening the backend with non empty username/password tries
to authenticate against the SMTP server.
"""
backend = smtp.EmailBackend(
@@ -1311,7 +1310,7 @@ class SMTPBackendTests(BaseEmailBackendTests, SMTPBackendTestsBase):
def test_server_open(self):
"""
- Test that open() tells us whether it opened a connection.
+ open() returns whether it opened a connection.
"""
backend = smtp.EmailBackend(username='', password='')
self.assertFalse(backend.connection)
@@ -1405,12 +1404,12 @@ class SMTPBackendTests(BaseEmailBackendTests, SMTPBackendTestsBase):
pass
def test_connection_timeout_default(self):
- """Test that the connection's timeout value is None by default."""
+ """The connection's timeout value is None by default."""
connection = mail.get_connection('django.core.mail.backends.smtp.EmailBackend')
self.assertIsNone(connection.timeout)
def test_connection_timeout_custom(self):
- """Test that the timeout parameter can be customized."""
+ """The timeout parameter can be customized."""
class MyEmailBackend(smtp.EmailBackend):
def __init__(self, *args, **kwargs):
kwargs.setdefault('timeout', 42)
@@ -1428,7 +1427,7 @@ class SMTPBackendTests(BaseEmailBackendTests, SMTPBackendTestsBase):
self.assertEqual(backend.timeout, 10)
def test_email_msg_uses_crlf(self):
- """#23063 -- Test that RFC-compliant messages are sent over SMTP."""
+ """#23063 -- RFC-compliant messages are sent over SMTP."""
send = SMTP.send
try:
smtp_messages = []
@@ -1453,7 +1452,7 @@ class SMTPBackendTests(BaseEmailBackendTests, SMTPBackendTestsBase):
if PY3:
msg = msg.decode('utf-8')
- # Ensure that the message only contains CRLF and not combinations of CRLF, LF, and CR.
+ # The message only contains CRLF and not combinations of CRLF, LF, and CR.
msg = msg.replace('\r\n', '')
self.assertNotIn('\r', msg)
self.assertNotIn('\n', msg)
diff --git a/tests/many_to_many/tests.py b/tests/many_to_many/tests.py
index 2d35266f46..2917214471 100644
--- a/tests/many_to_many/tests.py
+++ b/tests/many_to_many/tests.py
@@ -475,9 +475,9 @@ class ManyToManyTests(TestCase):
self.assertQuerysetEqual(self.a4.publications.all(), [''])
def test_forward_assign_with_queryset(self):
- # Ensure that querysets used in m2m assignments are pre-evaluated
- # so their value isn't affected by the clearing operation in
- # ManyRelatedManager.set() (#19816).
+ # Querysets used in m2m assignments are pre-evaluated so their value
+ # isn't affected by the clearing operation in ManyRelatedManager.set()
+ # (#19816).
self.a1.publications.set([self.p1, self.p2])
qs = self.a1.publications.filter(title='The Python Journal')
@@ -487,9 +487,9 @@ class ManyToManyTests(TestCase):
self.assertEqual(1, qs.count())
def test_reverse_assign_with_queryset(self):
- # Ensure that querysets used in M2M assignments are pre-evaluated
- # so their value isn't affected by the clearing operation in
- # ManyRelatedManager.set() (#19816).
+ # Querysets used in M2M assignments are pre-evaluated so their value
+ # isn't affected by the clearing operation in ManyRelatedManager.set()
+ # (#19816).
self.p1.article_set.set([self.a1, self.a2])
qs = self.p1.article_set.filter(headline='Django lets you build Web apps easily')
diff --git a/tests/many_to_one/tests.py b/tests/many_to_one/tests.py
index 0de6973bb8..4244bc4fb0 100644
--- a/tests/many_to_one/tests.py
+++ b/tests/many_to_one/tests.py
@@ -183,7 +183,7 @@ class ManyToOneTests(TestCase):
Article.objects.filter(reporter__first_name__exact='John'),
["", ""]
)
- # Check that implied __exact also works
+ # Implied __exact also works
self.assertQuerysetEqual(
Article.objects.filter(reporter__first_name='John'),
["", ""]
@@ -314,7 +314,7 @@ class ManyToOneTests(TestCase):
)
self.assertQuerysetEqual(Reporter.objects.filter(article__reporter__exact=self.r).distinct(), john_smith)
- # Check that implied __exact also works.
+ # Implied __exact also works.
self.assertQuerysetEqual(Reporter.objects.filter(article__reporter=self.r).distinct(), john_smith)
# It's possible to use values() calls across many-to-one relations.
@@ -327,8 +327,8 @@ class ManyToOneTests(TestCase):
self.assertEqual([d], list(qs))
def test_select_related(self):
- # Check that Article.objects.select_related().dates() works properly when
- # there are multiple Articles with the same date but different foreign-key
+ # Article.objects.select_related().dates() works properly when there
+ # are multiple Articles with the same date but different foreign-key
# objects (Reporters).
r1 = Reporter.objects.create(first_name='Mike', last_name='Royko', email='royko@suntimes.com')
r2 = Reporter.objects.create(first_name='John', last_name='Kass', email='jkass@tribune.com')
@@ -567,7 +567,7 @@ class ManyToOneTests(TestCase):
self.assertEqual('id', cat.remote_field.get_related_field().name)
def test_relation_unsaved(self):
- # Test that the _set manager does not join on Null value fields (#17541)
+ # The _set manager does not join on Null value fields (#17541)
Third.objects.create(name='Third 1')
Third.objects.create(name='Third 2')
th = Third(name="testing")
diff --git a/tests/many_to_one_null/tests.py b/tests/many_to_one_null/tests.py
index 1c2d751d07..dc49c61f69 100644
--- a/tests/many_to_one_null/tests.py
+++ b/tests/many_to_one_null/tests.py
@@ -102,7 +102,7 @@ class ManyToOneNullTests(TestCase):
)
def test_assign_with_queryset(self):
- # Ensure that querysets used in reverse FK assignments are pre-evaluated
+ # Querysets used in reverse FK assignments are pre-evaluated
# so their value isn't affected by the clearing operation in
# RelatedManager.set() (#19816).
self.r2.article_set.set([self.a2, self.a3])
diff --git a/tests/messages_tests/base.py b/tests/messages_tests/base.py
index 7b6cd43a1d..d578476f44 100644
--- a/tests/messages_tests/base.py
+++ b/tests/messages_tests/base.py
@@ -197,8 +197,7 @@ class BaseTests(object):
@override_settings(MESSAGE_LEVEL=constants.DEBUG)
def test_multiple_posts(self):
"""
- Tests that messages persist properly when multiple POSTs are made
- before a GET.
+ Messages persist properly when multiple POSTs are made before a GET.
"""
data = {
'messages': ['Test message %d' % x for x in range(5)],
@@ -229,8 +228,8 @@ class BaseTests(object):
)
def test_middleware_disabled(self):
"""
- Tests that, when the middleware is disabled, an exception is raised
- when one attempts to store a message.
+ When the middleware is disabled, an exception is raised when one
+ attempts to store a message.
"""
data = {
'messages': ['Test message %d' % x for x in range(5)],
@@ -254,8 +253,8 @@ class BaseTests(object):
)
def test_middleware_disabled_fail_silently(self):
"""
- Tests that, when the middleware is disabled, an exception is not
- raised if 'fail_silently' = True
+ When the middleware is disabled, an exception is not raised
+ if 'fail_silently' = True
"""
data = {
'messages': ['Test message %d' % x for x in range(5)],
@@ -285,8 +284,7 @@ class BaseTests(object):
def test_existing_read(self):
"""
- Tests that reading the existing storage doesn't cause the data to be
- lost.
+ Reading the existing storage doesn't cause the data to be lost.
"""
storage = self.get_existing_storage()
self.assertFalse(storage.used)
diff --git a/tests/messages_tests/test_cookie.py b/tests/messages_tests/test_cookie.py
index 421ff5b93a..58c7ecfc6c 100644
--- a/tests/messages_tests/test_cookie.py
+++ b/tests/messages_tests/test_cookie.py
@@ -54,13 +54,13 @@ class CookieTest(BaseTests, SimpleTestCase):
# Set initial data.
example_messages = ['test', 'me']
set_cookie_data(storage, example_messages)
- # Test that the message actually contains what we expect.
+ # The message actually contains what we expect.
self.assertEqual(list(storage), example_messages)
def test_cookie_setings(self):
"""
- Ensure that CookieStorage honors SESSION_COOKIE_DOMAIN, SESSION_COOKIE_SECURE and SESSION_COOKIE_HTTPONLY
- Refs #15618 and #20972.
+ CookieStorage honors SESSION_COOKIE_DOMAIN, SESSION_COOKIE_SECURE, and
+ SESSION_COOKIE_HTTPONLY (#15618, #20972).
"""
# Test before the messages have been consumed
storage = self.get_storage()
@@ -90,14 +90,13 @@ class CookieTest(BaseTests, SimpleTestCase):
# Set initial (invalid) data.
example_messages = ['test', 'me']
set_cookie_data(storage, example_messages, invalid=True)
- # Test that the message actually contains what we expect.
+ # The message actually contains what we expect.
self.assertEqual(list(storage), [])
def test_max_cookie_length(self):
"""
- Tests that, if the data exceeds what is allowed in a cookie, older
- messages are removed before saving (and returned by the ``update``
- method).
+ If the data exceeds what is allowed in a cookie, older messages are
+ removed before saving (and returned by the ``update`` method).
"""
storage = self.get_storage()
response = self.get_response()
@@ -120,7 +119,7 @@ class CookieTest(BaseTests, SimpleTestCase):
def test_json_encoder_decoder(self):
"""
- Tests that a complex nested data structure containing Message
+ A complex nested data structure containing Message
instances is properly encoded/decoded by the custom JSON
encoder/decoder classes.
"""
@@ -140,7 +139,7 @@ class CookieTest(BaseTests, SimpleTestCase):
def test_safedata(self):
"""
- Tests that a message containing SafeData is keeping its safe status when
+ A message containing SafeData is keeping its safe status when
retrieved from the message storage.
"""
def encode_decode(data):
diff --git a/tests/messages_tests/test_fallback.py b/tests/messages_tests/test_fallback.py
index 647941b8b2..dfba0a2dc3 100644
--- a/tests/messages_tests/test_fallback.py
+++ b/tests/messages_tests/test_fallback.py
@@ -25,8 +25,7 @@ class FallbackTest(BaseTests, SimpleTestCase):
return storage.storages[-1]
def stored_cookie_messages_count(self, storage, response):
- return stored_cookie_messages_count(self.get_cookie_storage(storage),
- response)
+ return stored_cookie_messages_count(self.get_cookie_storage(storage), response)
def stored_session_messages_count(self, storage, response):
return stored_session_messages_count(self.get_session_storage(storage))
@@ -35,9 +34,10 @@ class FallbackTest(BaseTests, SimpleTestCase):
"""
Return the storage totals from both cookie and session backends.
"""
- total = (self.stored_cookie_messages_count(storage, response) +
- self.stored_session_messages_count(storage, response))
- return total
+ return (
+ self.stored_cookie_messages_count(storage, response) +
+ self.stored_session_messages_count(storage, response)
+ )
def test_get(self):
request = self.get_request()
@@ -52,7 +52,6 @@ class FallbackTest(BaseTests, SimpleTestCase):
# used (it would cause a TypeError: 'NoneType' object is not callable).
self.get_session_storage(storage)._get = None
- # Test that the message actually contains what we expect.
self.assertEqual(list(storage), example_messages)
def test_get_empty(self):
@@ -63,7 +62,6 @@ class FallbackTest(BaseTests, SimpleTestCase):
# used (it would cause a TypeError: 'NoneType' object is not callable).
self.get_session_storage(storage)._get = None
- # Test that the message actually contains what we expect.
self.assertEqual(list(storage), [])
def test_get_fallback(self):
@@ -74,11 +72,9 @@ class FallbackTest(BaseTests, SimpleTestCase):
# Set initial cookie and session data.
example_messages = [str(i) for i in range(5)]
- set_cookie_data(cookie_storage, example_messages[:4] +
- [CookieStorage.not_finished])
+ set_cookie_data(cookie_storage, example_messages[:4] + [CookieStorage.not_finished])
set_session_data(session_storage, example_messages[4:])
- # Test that the message actually contains what we expect.
self.assertEqual(list(storage), example_messages)
def test_get_fallback_only(self):
@@ -89,11 +85,9 @@ class FallbackTest(BaseTests, SimpleTestCase):
# Set initial cookie and session data.
example_messages = [str(i) for i in range(5)]
- set_cookie_data(cookie_storage, [CookieStorage.not_finished],
- encode_empty=True)
+ set_cookie_data(cookie_storage, [CookieStorage.not_finished], encode_empty=True)
set_session_data(session_storage, example_messages)
- # Test that the message actually contains what we expect.
self.assertEqual(list(storage), example_messages)
def test_flush_used_backends(self):
@@ -116,8 +110,6 @@ class FallbackTest(BaseTests, SimpleTestCase):
def test_no_fallback(self):
"""
- Confirms that:
-
(1) A short number of messages whose data size doesn't exceed what is
allowed in a cookie will all be stored in the CookieBackend.
@@ -142,8 +134,8 @@ class FallbackTest(BaseTests, SimpleTestCase):
def test_session_fallback(self):
"""
- Confirms that, if the data exceeds what is allowed in a cookie,
- messages which did not fit are stored in the SessionBackend.
+ If the data exceeds what is allowed in a cookie, messages which did
+ not fit are stored in the SessionBackend.
"""
storage = self.get_storage()
response = self.get_response()
@@ -161,8 +153,8 @@ class FallbackTest(BaseTests, SimpleTestCase):
def test_session_fallback_only(self):
"""
- Confirms that large messages, none of which fit in a cookie, are stored
- in the SessionBackend (and nothing is stored in the CookieBackend).
+ Large messages, none of which fit in a cookie, are stored in the
+ SessionBackend (and nothing is stored in the CookieBackend).
"""
storage = self.get_storage()
response = self.get_response()
diff --git a/tests/messages_tests/test_session.py b/tests/messages_tests/test_session.py
index 3d211f6f8d..868f0931a9 100644
--- a/tests/messages_tests/test_session.py
+++ b/tests/messages_tests/test_session.py
@@ -36,19 +36,16 @@ class SessionTest(BaseTests, TestCase):
def test_get(self):
storage = self.storage_class(self.get_request())
- # Set initial data.
example_messages = ['test', 'me']
set_session_data(storage, example_messages)
- # Test that the message actually contains what we expect.
self.assertEqual(list(storage), example_messages)
def test_safedata(self):
"""
- Tests that a message containing SafeData is keeping its safe status when
- retrieved from the message storage.
+ A message containing SafeData keeps its safe status when retrieved from
+ the message storage.
"""
storage = self.get_storage()
-
message = Message(constants.DEBUG, mark_safe("Hello Django!"))
set_session_data(storage, [message])
self.assertIsInstance(list(storage)[0].message, SafeData)
diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py
index 7f8faf7630..1d473ef558 100644
--- a/tests/middleware/tests.py
+++ b/tests/middleware/tests.py
@@ -98,7 +98,7 @@ class CommonMiddlewareTest(SimpleTestCase):
@override_settings(APPEND_SLASH=True, DEBUG=True)
def test_append_slash_no_redirect_on_POST_in_DEBUG(self):
"""
- Tests that while in debug mode, an exception is raised with a warning
+ While in debug mode, an exception is raised with a warning
when a failed attempt is made to POST, PUT, or PATCH to an URL which
would normally be redirected to a slashed version.
"""
@@ -210,7 +210,7 @@ class CommonMiddlewareTest(SimpleTestCase):
@override_settings(APPEND_SLASH=True, DEBUG=True)
def test_append_slash_no_redirect_on_POST_in_DEBUG_custom_urlconf(self):
"""
- Tests that while in debug mode, an exception is raised with a warning
+ While in debug mode, an exception is raised with a warning
when a failed attempt is made to POST to an URL which would normally be
redirected to a slashed version.
"""
diff --git a/tests/middleware_exceptions/test_legacy.py b/tests/middleware_exceptions/test_legacy.py
index 227361c04a..b35deb90b2 100644
--- a/tests/middleware_exceptions/test_legacy.py
+++ b/tests/middleware_exceptions/test_legacy.py
@@ -206,7 +206,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/view/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -220,7 +220,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/view/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -234,7 +234,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/view/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, True, False, True, False)
@@ -248,7 +248,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/template_response/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, True, True, False)
self.assert_middleware_usage(middleware, True, True, True, True, False)
self.assert_middleware_usage(post_middleware, True, True, True, True, False)
@@ -262,7 +262,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/view/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, True, False, True, False)
@@ -276,7 +276,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/not_found/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -290,7 +290,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/not_found/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -304,7 +304,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/not_found/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, True)
self.assert_middleware_usage(middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -318,7 +318,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/not_found/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, True)
self.assert_middleware_usage(middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -332,7 +332,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/not_found/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -346,7 +346,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/error/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -360,7 +360,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/error/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -374,7 +374,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/error/', ['Error in view'], Exception())
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, True)
self.assert_middleware_usage(middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -388,7 +388,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/error/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -402,7 +402,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -416,7 +416,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -436,7 +436,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
ValueError()
)
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, True, False, True, False)
@@ -456,7 +456,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
ValueError()
)
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, True, False, True, False)
@@ -470,7 +470,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/permission_denied/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -484,7 +484,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/permission_denied/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -498,7 +498,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/permission_denied/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, True)
self.assert_middleware_usage(middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -512,7 +512,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/permission_denied/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -522,7 +522,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(middleware)
self.assert_exceptions_handled('/middleware_exceptions/template_response_error/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(middleware, True, True, True, True, False)
def test_templateresponse_from_process_view_rendered(self):
@@ -561,7 +561,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/view/', ['Test Request Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(bad_middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -575,7 +575,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/view/', ['Test View Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -592,7 +592,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
['Test Template Response Exception']
)
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, True, True, False)
self.assert_middleware_usage(post_middleware, True, True, True, True, False)
@@ -606,7 +606,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/view/', ['Test Response Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, False, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, True, False, True, False)
@@ -620,7 +620,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/view/', [])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, True, False, True, False)
@@ -634,7 +634,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/not_found/', ['Test Request Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(bad_middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -648,7 +648,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/not_found/', ['Test View Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -662,7 +662,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/not_found/', ['Test Response Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, False, True)
self.assert_middleware_usage(bad_middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -676,7 +676,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/not_found/', ['Test Exception Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -690,7 +690,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/error/', ['Test Request Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(bad_middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -704,7 +704,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/error/', ['Test View Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -718,7 +718,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/error/', ['Error in view', 'Test Response Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, False, True)
self.assert_middleware_usage(bad_middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -732,7 +732,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/error/', ['Test Exception Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -746,7 +746,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', ['Test Request Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(bad_middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -760,7 +760,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', ['Test View Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -780,7 +780,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
]
)
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, False, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, True, False, True, False)
@@ -800,7 +800,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
ValueError()
)
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, True, False, True, False)
@@ -814,7 +814,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/permission_denied/', ['Test Request Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, False, False, True, False)
self.assert_middleware_usage(bad_middleware, True, False, False, True, False)
self.assert_middleware_usage(post_middleware, False, False, False, True, False)
@@ -828,7 +828,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/permission_denied/', ['Test View Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, False, False, True, False)
@@ -842,7 +842,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/permission_denied/', ['Test Response Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, False, True)
self.assert_middleware_usage(bad_middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -856,7 +856,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/permission_denied/', ['Test Exception Exception'])
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(bad_middleware, True, True, False, True, True)
self.assert_middleware_usage(post_middleware, True, True, False, True, True)
@@ -873,7 +873,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
],
ValueError())
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, False, False)
self.assert_middleware_usage(middleware, True, True, False, True, False)
self.assert_middleware_usage(post_middleware, True, True, False, True, False)
@@ -893,7 +893,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
ValueError()
)
- # Check that the right middleware methods have been invoked
+ # The right middleware methods have been invoked
self.assert_middleware_usage(pre_middleware, True, True, False, True, False)
self.assert_middleware_usage(middleware, True, True, True, True, False)
self.assert_middleware_usage(post_middleware, True, True, True, True, False)
diff --git a/tests/migration_test_data_persistence/tests.py b/tests/migration_test_data_persistence/tests.py
index 316cd21965..862a06c4a5 100644
--- a/tests/migration_test_data_persistence/tests.py
+++ b/tests/migration_test_data_persistence/tests.py
@@ -5,8 +5,8 @@ from .models import Book
class MigrationDataPersistenceTestCase(TransactionTestCase):
"""
- Tests that data loaded in migrations is available if we set
- serialized_rollback = True on TransactionTestCase
+ Data loaded in migrations is available if
+ TransactionTestCase.serialized_rollback = True.
"""
available_apps = ["migration_test_data_persistence"]
@@ -21,7 +21,7 @@ class MigrationDataPersistenceTestCase(TransactionTestCase):
class MigrationDataNormalPersistenceTestCase(TestCase):
"""
- Tests that data loaded in migrations is available on TestCase
+ Data loaded in migrations is available on TestCase
"""
def test_persistence(self):
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
index b5d9da07d3..bf31831071 100644
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -603,8 +603,7 @@ class AutodetectorTests(TestCase):
def test_trim_apps(self):
"""
- Tests that trim does not remove dependencies but does remove unwanted
- apps.
+ Trim does not remove dependencies but does remove unwanted apps.
"""
# Use project state to make a new migration change set
before = self.make_project_state([])
@@ -874,7 +873,7 @@ class AutodetectorTests(TestCase):
def test_rename_model_with_fks_in_different_position(self):
"""
- #24537 - Tests that the order of fields in a model does not influence
+ #24537 - The order of fields in a model does not influence
the RenameModel detection.
"""
before = [
@@ -903,7 +902,7 @@ class AutodetectorTests(TestCase):
self.assertOperationAttributes(changes, "testapp", 0, 0, old_name="EntityB", new_name="RenamedEntityB")
def test_fk_dependency(self):
- """Tests that having a ForeignKey automatically adds a dependency."""
+ """Having a ForeignKey automatically adds a dependency."""
# Note that testapp (author) has no dependencies,
# otherapp (book) depends on testapp (author),
# thirdapp (edition) depends on otherapp (book)
@@ -925,7 +924,7 @@ class AutodetectorTests(TestCase):
self.assertMigrationDependencies(changes, 'thirdapp', 0, [("otherapp", "auto_1")])
def test_proxy_fk_dependency(self):
- """Tests that FK dependencies still work on proxy models."""
+ """FK dependencies still work on proxy models."""
# Note that testapp (author) has no dependencies,
# otherapp (book) depends on testapp (authorproxy)
changes = self.get_changes([], [self.author_empty, self.author_proxy_third, self.book_proxy_fk])
@@ -947,7 +946,7 @@ class AutodetectorTests(TestCase):
def test_same_app_no_fk_dependency(self):
"""
- Tests that a migration with a FK between two models of the same app
+ A migration with a FK between two models of the same app
does not have a dependency to itself.
"""
changes = self.get_changes([], [self.author_with_publisher, self.publisher])
@@ -961,7 +960,7 @@ class AutodetectorTests(TestCase):
def test_circular_fk_dependency(self):
"""
- Tests that having a circular ForeignKey dependency automatically
+ Having a circular ForeignKey dependency automatically
resolves the situation into 2 migrations on one side and 1 on the other.
"""
changes = self.get_changes([], [self.author_with_book, self.book, self.publisher_with_book])
@@ -983,7 +982,7 @@ class AutodetectorTests(TestCase):
def test_same_app_circular_fk_dependency(self):
"""
- Tests that a migration with a FK between two models of the same app does
+ A migration with a FK between two models of the same app does
not have a dependency to itself.
"""
changes = self.get_changes([], [self.author_with_publisher, self.publisher_with_author])
@@ -997,7 +996,7 @@ class AutodetectorTests(TestCase):
def test_same_app_circular_fk_dependency_with_unique_together_and_indexes(self):
"""
- #22275 - Tests that a migration with circular FK dependency does not try
+ #22275 - A migration with circular FK dependency does not try
to create unique together constraint and indexes before creating all
required fields first.
"""
@@ -1037,8 +1036,7 @@ class AutodetectorTests(TestCase):
def test_alter_db_table_no_changes(self):
"""
- Tests that alter_db_table doesn't generate a migration if no changes
- have been made.
+ Alter_db_table doesn't generate a migration if no changes have been made.
"""
changes = self.get_changes([self.author_with_db_table_options], [self.author_with_db_table_options])
# Right number of migrations?
@@ -1233,7 +1231,7 @@ class AutodetectorTests(TestCase):
def test_foo_together_no_changes(self):
"""
- Tests that index/unique_together doesn't generate a migration if no
+ index/unique_together doesn't generate a migration if no
changes have been made.
"""
changes = self.get_changes(
@@ -1244,7 +1242,7 @@ class AutodetectorTests(TestCase):
def test_foo_together_ordering(self):
"""
- Tests that index/unique_together also triggers on ordering changes.
+ index/unique_together also triggers on ordering changes.
"""
changes = self.get_changes(
[self.author_empty, self.book_foo_together], [self.author_empty, self.book_foo_together_2]
@@ -1257,8 +1255,7 @@ class AutodetectorTests(TestCase):
def test_add_field_and_foo_together(self):
"""
- Tests that added fields will be created before using them in
- index/unique_together.
+ Added fields will be created before using them in index/unique_together.
"""
changes = self.get_changes([self.author_empty, self.book], [self.author_empty, self.book_foo_together_3])
# Right number/type of migrations?
@@ -1294,8 +1291,7 @@ class AutodetectorTests(TestCase):
def test_remove_field_and_foo_together(self):
"""
- Tests that removed fields will be removed after updating
- index/unique_together.
+ Removed fields will be removed after updating index/unique_together.
"""
changes = self.get_changes(
[self.author_empty, self.book_foo_together_3], [self.author_empty, self.book_foo_together]
@@ -1309,8 +1305,7 @@ class AutodetectorTests(TestCase):
def test_rename_field_and_foo_together(self):
"""
- Tests that removed fields will be removed after updating
- index/unique_together.
+ Removed fields will be removed after updating index/unique_together.
"""
changes = self.get_changes(
[self.author_empty, self.book_foo_together_3],
@@ -1326,7 +1321,7 @@ class AutodetectorTests(TestCase):
self.assertOperationAttributes(changes, "otherapp", 0, 2, name="book", index_together={("title", "newfield2")})
def test_proxy(self):
- """Tests that the autodetector correctly deals with proxy models."""
+ """The autodetector correctly deals with proxy models."""
# First, we test adding a proxy model
changes = self.get_changes([self.author_empty], [self.author_empty, self.author_proxy])
# Right number/type of migrations?
@@ -1428,7 +1423,7 @@ class AutodetectorTests(TestCase):
self.assertEqual(changes['otherapp'][0].operations[0].field.remote_field.field_name, 'author_ptr')
def test_unmanaged_create(self):
- """Tests that the autodetector correctly deals with managed models."""
+ """The autodetector correctly deals with managed models."""
# First, we test adding an unmanaged model
changes = self.get_changes([self.author_empty], [self.author_empty, self.author_unmanaged])
# Right number/type of migrations?
@@ -1749,7 +1744,7 @@ class AutodetectorTests(TestCase):
def test_concrete_field_changed_to_many_to_many(self):
"""
- #23938 - Tests that changing a concrete field into a ManyToManyField
+ #23938 - Changing a concrete field into a ManyToManyField
first removes the concrete field and then adds the m2m field.
"""
changes = self.get_changes([self.author_with_former_m2m], [self.author_with_m2m, self.publisher])
@@ -1762,7 +1757,7 @@ class AutodetectorTests(TestCase):
def test_many_to_many_changed_to_concrete_field(self):
"""
- #23938 - Tests that changing a ManyToManyField into a concrete field
+ #23938 - Changing a ManyToManyField into a concrete field
first removes the m2m field and then adds the concrete field.
"""
changes = self.get_changes([self.author_with_m2m, self.publisher], [self.author_with_former_m2m])
@@ -1819,7 +1814,7 @@ class AutodetectorTests(TestCase):
})
def test_set_alter_order_with_respect_to(self):
- """Tests that setting order_with_respect_to adds a field."""
+ """Setting order_with_respect_to adds a field."""
changes = self.get_changes([self.book, self.author_with_book], [self.book, self.author_with_book_order_wrt])
# Right number/type of migrations?
self.assertNumberMigrations(changes, 'testapp', 1)
@@ -1828,7 +1823,7 @@ class AutodetectorTests(TestCase):
def test_add_alter_order_with_respect_to(self):
"""
- Tests that setting order_with_respect_to when adding the FK too does
+ Setting order_with_respect_to when adding the FK too does
things in the right order.
"""
changes = self.get_changes([self.author_name], [self.book, self.author_with_book_order_wrt])
@@ -1840,7 +1835,7 @@ class AutodetectorTests(TestCase):
def test_remove_alter_order_with_respect_to(self):
"""
- Tests that removing order_with_respect_to when removing the FK too does
+ Removing order_with_respect_to when removing the FK too does
things in the right order.
"""
changes = self.get_changes([self.book, self.author_with_book_order_wrt], [self.author_name])
@@ -1852,7 +1847,7 @@ class AutodetectorTests(TestCase):
def test_add_model_order_with_respect_to(self):
"""
- Tests that setting order_with_respect_to when adding the whole model
+ Setting order_with_respect_to when adding the whole model
does things in the right order.
"""
changes = self.get_changes([], [self.book, self.author_with_book_order_wrt])
@@ -1864,7 +1859,7 @@ class AutodetectorTests(TestCase):
def test_alter_model_managers(self):
"""
- Tests that changing the model managers adds a new operation.
+ Changing the model managers adds a new operation.
"""
changes = self.get_changes([self.other_pony], [self.other_pony_food])
# Right number/type of migrations?
@@ -1877,7 +1872,7 @@ class AutodetectorTests(TestCase):
self.assertEqual(changes['otherapp'][0].operations[0].managers[2][1].args, ('x', 'y', 3, 4))
def test_swappable_first_inheritance(self):
- """Tests that swappable models get their CreateModel first."""
+ """Swappable models get their CreateModel first."""
changes = self.get_changes([], [self.custom_user, self.aardvark])
# Right number/type of migrations?
self.assertNumberMigrations(changes, 'thirdapp', 1)
@@ -1887,7 +1882,7 @@ class AutodetectorTests(TestCase):
@override_settings(AUTH_USER_MODEL="thirdapp.CustomUser")
def test_swappable_first_setting(self):
- """Tests that swappable models get their CreateModel first."""
+ """Swappable models get their CreateModel first."""
with isolate_lru_cache(apps.get_swappable_settings_name):
changes = self.get_changes([], [self.custom_user_no_inherit, self.aardvark])
# Right number/type of migrations?
@@ -1897,7 +1892,7 @@ class AutodetectorTests(TestCase):
self.assertOperationAttributes(changes, 'thirdapp', 0, 1, name="Aardvark")
def test_bases_first(self):
- """Tests that bases of other models come first."""
+ """Bases of other models come first."""
changes = self.get_changes([], [self.aardvark_based_on_author, self.author_name])
# Right number/type of migrations?
self.assertNumberMigrations(changes, 'testapp', 1)
@@ -1906,7 +1901,7 @@ class AutodetectorTests(TestCase):
self.assertOperationAttributes(changes, 'testapp', 0, 1, name="Aardvark")
def test_multiple_bases(self):
- """#23956 - Tests that inheriting models doesn't move *_ptr fields into AddField operations."""
+ """#23956 - Inheriting models doesn't move *_ptr fields into AddField operations."""
A = ModelState("app", "A", [("a_id", models.AutoField(primary_key=True))])
B = ModelState("app", "B", [("b_id", models.AutoField(primary_key=True))])
C = ModelState("app", "C", [], bases=("app.A", "app.B"))
@@ -1925,7 +1920,7 @@ class AutodetectorTests(TestCase):
self.assertOperationAttributes(changes, "app", 0, 4, name="E")
def test_proxy_bases_first(self):
- """Tests that bases of proxies come first."""
+ """Bases of proxies come first."""
changes = self.get_changes([], [self.author_empty, self.author_proxy, self.author_proxy_proxy])
# Right number/type of migrations?
self.assertNumberMigrations(changes, 'testapp', 1)
@@ -1936,8 +1931,7 @@ class AutodetectorTests(TestCase):
def test_pk_fk_included(self):
"""
- Tests that a relation used as the primary key is kept as part of
- CreateModel.
+ A relation used as the primary key is kept as part of CreateModel.
"""
changes = self.get_changes([], [self.aardvark_pk_fk_author, self.author_name])
# Right number/type of migrations?
@@ -1948,7 +1942,7 @@ class AutodetectorTests(TestCase):
def test_first_dependency(self):
"""
- Tests that a dependency to an app with no migrations uses __first__.
+ A dependency to an app with no migrations uses __first__.
"""
# Load graph
loader = MigrationLoader(connection)
@@ -1966,7 +1960,7 @@ class AutodetectorTests(TestCase):
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
def test_last_dependency(self):
"""
- Tests that a dependency to an app with existing migrations uses the
+ A dependency to an app with existing migrations uses the
last migration of that app.
"""
# Load graph
@@ -1984,7 +1978,7 @@ class AutodetectorTests(TestCase):
def test_alter_fk_before_model_deletion(self):
"""
- Tests that ForeignKeys are altered _before_ the model they used to
+ ForeignKeys are altered _before_ the model they used to
refer to are deleted.
"""
changes = self.get_changes(
@@ -2000,7 +1994,7 @@ class AutodetectorTests(TestCase):
def test_fk_dependency_other_app(self):
"""
- #23100 - Tests that ForeignKeys correctly depend on other apps' models.
+ #23100 - ForeignKeys correctly depend on other apps' models.
"""
changes = self.get_changes([self.author_name, self.book], [self.author_with_book, self.book])
# Right number/type of migrations?
@@ -2011,7 +2005,7 @@ class AutodetectorTests(TestCase):
def test_circular_dependency_mixed_addcreate(self):
"""
- #23315 - Tests that the dependency resolver knows to put all CreateModel
+ #23315 - The dependency resolver knows to put all CreateModel
before AddField and not become unsolvable.
"""
address = ModelState("a", "Address", [
@@ -2039,7 +2033,7 @@ class AutodetectorTests(TestCase):
@override_settings(AUTH_USER_MODEL="a.Tenant")
def test_circular_dependency_swappable(self):
"""
- #23322 - Tests that the dependency resolver knows to explicitly resolve
+ #23322 - The dependency resolver knows to explicitly resolve
swappable models.
"""
with isolate_lru_cache(apps.get_swappable_settings_name):
@@ -2068,7 +2062,7 @@ class AutodetectorTests(TestCase):
@override_settings(AUTH_USER_MODEL="b.Tenant")
def test_circular_dependency_swappable2(self):
"""
- #23322 - Tests that the dependency resolver knows to explicitly resolve
+ #23322 - The dependency resolver knows to explicitly resolve
swappable models but with the swappable not being the first migrated
model.
"""
@@ -2097,7 +2091,7 @@ class AutodetectorTests(TestCase):
@override_settings(AUTH_USER_MODEL="a.Person")
def test_circular_dependency_swappable_self(self):
"""
- #23322 - Tests that the dependency resolver knows to explicitly resolve
+ #23322 - The dependency resolver knows to explicitly resolve
swappable models.
"""
with isolate_lru_cache(apps.get_swappable_settings_name):
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index e138ef40bf..d329e50933 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -37,25 +37,25 @@ class MigrateTests(MigrationTestBase):
"""
Tests basic usage of the migrate command.
"""
- # Make sure no tables are created
+ # No tables are created
self.assertTableNotExists("migrations_author")
self.assertTableNotExists("migrations_tribble")
self.assertTableNotExists("migrations_book")
# Run the migrations to 0001 only
call_command("migrate", "migrations", "0001", verbosity=0)
- # Make sure the right tables exist
+ # The correct tables exist
self.assertTableExists("migrations_author")
self.assertTableExists("migrations_tribble")
self.assertTableNotExists("migrations_book")
# Run migrations all the way
call_command("migrate", verbosity=0)
- # Make sure the right tables exist
+ # The correct tables exist
self.assertTableExists("migrations_author")
self.assertTableNotExists("migrations_tribble")
self.assertTableExists("migrations_book")
# Unmigrate everything
call_command("migrate", "migrations", "zero", verbosity=0)
- # Make sure it's all gone
+ # Tables are gone
self.assertTableNotExists("migrations_author")
self.assertTableNotExists("migrations_tribble")
self.assertTableNotExists("migrations_book")
@@ -194,7 +194,7 @@ class MigrateTests(MigrationTestBase):
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_conflict"})
def test_migrate_conflict_exit(self):
"""
- Makes sure that migrate exits if it detects a conflict.
+ migrate exits if it detects a conflict.
"""
with self.assertRaisesMessage(CommandError, "Conflicting migrations detected"):
call_command("migrate", "migrations")
@@ -202,7 +202,8 @@ class MigrateTests(MigrationTestBase):
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
def test_showmigrations_list(self):
"""
- Tests --list output of showmigrations command
+ showmigrations --list displays migrations and whether or not they're
+ applied.
"""
out = six.StringIO()
with mock.patch('django.core.management.color.supports_color', lambda *args: True):
@@ -340,7 +341,7 @@ class MigrateTests(MigrationTestBase):
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
def test_sqlmigrate_forwards(self):
"""
- Makes sure that sqlmigrate does something.
+ sqlmigrate outputs forward looking SQL.
"""
out = six.StringIO()
call_command("sqlmigrate", "migrations", "0001", stdout=out)
@@ -378,7 +379,7 @@ class MigrateTests(MigrationTestBase):
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
def test_sqlmigrate_backwards(self):
"""
- Makes sure that sqlmigrate does something.
+ sqlmigrate outputs reverse looking SQL.
"""
# Cannot generate the reverse SQL unless we've applied the migration.
call_command("migrate", "migrations", verbosity=0)
@@ -437,11 +438,11 @@ class MigrateTests(MigrationTestBase):
INSTALLED_APPS=[
"migrations.migrations_test_apps.migrated_app",
"migrations.migrations_test_apps.migrated_unapplied_app",
- "migrations.migrations_test_apps.unmigrated_app"])
+ "migrations.migrations_test_apps.unmigrated_app",
+ ],
+ )
def test_regression_22823_unmigrated_fk_to_migrated_model(self):
"""
- https://code.djangoproject.com/ticket/22823
-
Assuming you have 3 apps, `A`, `B`, and `C`, such that:
* `A` has migrations
@@ -450,7 +451,7 @@ class MigrateTests(MigrationTestBase):
When we try to migrate "B", an exception occurs because the
"B" was not included in the ProjectState that is used to detect
- soft-applied migrations.
+ soft-applied migrations (#22823).
"""
call_command("migrate", "migrated_unapplied_app", stdout=six.StringIO())
@@ -663,7 +664,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_conflict_exit(self):
"""
- Makes sure that makemigrations exits if it detects a conflict.
+ makemigrations exits if it detects a conflict.
"""
with self.temporary_migration_module(module="migrations.test_migrations_conflict"):
with self.assertRaises(CommandError):
@@ -671,7 +672,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_merge_no_conflict(self):
"""
- Makes sure that makemigrations exits if in merge mode with no conflicts.
+ makemigrations exits if in merge mode with no conflicts.
"""
out = six.StringIO()
with self.temporary_migration_module(module="migrations.test_migrations"):
@@ -680,7 +681,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_no_app_sys_exit(self):
"""
- Makes sure that makemigrations exits if a non-existent app is specified.
+ makemigrations exits if a non-existent app is specified.
"""
err = six.StringIO()
with self.assertRaises(SystemExit):
@@ -689,14 +690,14 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_empty_no_app_specified(self):
"""
- Makes sure that makemigrations exits if no app is specified with 'empty' mode.
+ makemigrations exits if no app is specified with 'empty' mode.
"""
with self.assertRaises(CommandError):
call_command("makemigrations", empty=True)
def test_makemigrations_empty_migration(self):
"""
- Makes sure that makemigrations properly constructs an empty migration.
+ makemigrations properly constructs an empty migration.
"""
with self.temporary_migration_module() as migration_dir:
call_command("makemigrations", "migrations", empty=True, verbosity=0)
@@ -729,7 +730,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_no_changes_no_apps(self):
"""
- Makes sure that makemigrations exits when there are no changes and no apps are specified.
+ makemigrations exits when there are no changes and no apps are specified.
"""
out = six.StringIO()
call_command("makemigrations", stdout=out)
@@ -737,7 +738,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_no_changes(self):
"""
- Makes sure that makemigrations exits when there are no changes to an app.
+ makemigrations exits when there are no changes to an app.
"""
out = six.StringIO()
with self.temporary_migration_module(module="migrations.test_migrations_no_changes"):
@@ -756,7 +757,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_migrations_announce(self):
"""
- Makes sure that makemigrations announces the migration at the default verbosity level.
+ makemigrations announces the migration at the default verbosity level.
"""
out = six.StringIO()
with self.temporary_migration_module():
@@ -765,7 +766,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_no_common_ancestor(self):
"""
- Makes sure that makemigrations fails to merge migrations with no common ancestor.
+ makemigrations fails to merge migrations with no common ancestor.
"""
with self.assertRaises(ValueError) as context:
with self.temporary_migration_module(module="migrations.test_migrations_no_ancestor"):
@@ -777,7 +778,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_interactive_reject(self):
"""
- Makes sure that makemigrations enters and exits interactive mode properly.
+ makemigrations enters and exits interactive mode properly.
"""
# Monkeypatch interactive questioner to auto reject
with mock.patch('django.db.migrations.questioner.input', mock.Mock(return_value='N')):
@@ -788,7 +789,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_interactive_accept(self):
"""
- Makes sure that makemigrations enters interactive mode and merges properly.
+ makemigrations enters interactive mode and merges properly.
"""
# Monkeypatch interactive questioner to auto accept
with mock.patch('django.db.migrations.questioner.input', mock.Mock(return_value='y')):
@@ -812,7 +813,8 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_non_interactive_not_null_addition(self):
"""
- Tests that non-interactive makemigrations fails when a default is missing on a new not-null field.
+ Non-interactive makemigrations fails when a default is missing on a
+ new not-null field.
"""
class SillyModel(models.Model):
silly_field = models.BooleanField(default=False)
@@ -828,7 +830,8 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_non_interactive_not_null_alteration(self):
"""
- Tests that non-interactive makemigrations fails when a default is missing on a field changed to not-null.
+ Non-interactive makemigrations fails when a default is missing on a
+ field changed to not-null.
"""
class Author(models.Model):
name = models.CharField(max_length=255)
@@ -845,7 +848,8 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_non_interactive_no_model_rename(self):
"""
- Makes sure that makemigrations adds and removes a possible model rename in non-interactive mode.
+ makemigrations adds and removes a possible model rename in
+ non-interactive mode.
"""
class RenamedModel(models.Model):
silly_field = models.BooleanField(default=False)
@@ -861,7 +865,8 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_non_interactive_no_field_rename(self):
"""
- Makes sure that makemigrations adds and removes a possible field rename in non-interactive mode.
+ makemigrations adds and removes a possible field rename in
+ non-interactive mode.
"""
class SillyModel(models.Model):
silly_rename = models.BooleanField(default=False)
@@ -877,7 +882,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_handle_merge(self):
"""
- Makes sure that makemigrations properly merges the conflicting migrations with --noinput.
+ makemigrations properly merges the conflicting migrations with --noinput.
"""
out = six.StringIO()
with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir:
@@ -892,8 +897,8 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigration_merge_dry_run(self):
"""
- Makes sure that makemigrations respects --dry-run option when fixing
- migration conflicts (#24427).
+ makemigrations respects --dry-run option when fixing migration
+ conflicts (#24427).
"""
out = six.StringIO()
with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir:
@@ -911,8 +916,8 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigration_merge_dry_run_verbosity_3(self):
"""
- Makes sure that `makemigrations --merge --dry-run` writes the merge
- migration file to stdout with `verbosity == 3` (#24427).
+ `makemigrations --merge --dry-run` writes the merge migration file to
+ stdout with `verbosity == 3` (#24427).
"""
out = six.StringIO()
with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir:
@@ -941,9 +946,8 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_dry_run(self):
"""
- Ticket #22676 -- `makemigrations --dry-run` should not ask for defaults.
+ `makemigrations --dry-run` should not ask for defaults.
"""
-
class SillyModel(models.Model):
silly_field = models.BooleanField(default=False)
silly_date = models.DateField() # Added field without a default
@@ -959,10 +963,9 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_dry_run_verbosity_3(self):
"""
- Ticket #22675 -- Allow `makemigrations --dry-run` to output the
- migrations file to stdout (with verbosity == 3).
+ Allow `makemigrations --dry-run` to output the migrations file to
+ stdout (with verbosity == 3).
"""
-
class SillyModel(models.Model):
silly_field = models.BooleanField(default=False)
silly_char = models.CharField(default="")
@@ -989,11 +992,10 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_migrations_modules_path_not_exist(self):
"""
- Ticket #22682 -- Makemigrations fails when specifying custom location
- for migration files (using MIGRATION_MODULES) if the custom path
+ makemigrations creates migrations when specifying a custom location
+ for migration files using MIGRATION_MODULES if the custom path
doesn't already exist.
"""
-
class SillyModel(models.Model):
silly_field = models.BooleanField(default=False)
@@ -1014,9 +1016,9 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_interactive_by_default(self):
"""
- Makes sure that the user is prompted to merge by default if there are
- conflicts and merge is True. Answer negative to differentiate it from
- behavior when --noinput is specified.
+ The user is prompted to merge by default if there are conflicts and
+ merge is True. Answer negative to differentiate it from behavior when
+ --noinput is specified.
"""
# Monkeypatch interactive questioner to auto reject
out = six.StringIO()
@@ -1034,8 +1036,8 @@ class MakeMigrationsTests(MigrationTestBase):
"migrations.migrations_test_apps.unspecified_app_with_conflict"])
def test_makemigrations_unspecified_app_with_conflict_no_merge(self):
"""
- Makes sure that makemigrations does not raise a CommandError when an
- unspecified app has conflicting migrations.
+ makemigrations does not raise a CommandError when an unspecified app
+ has conflicting migrations.
"""
with self.temporary_migration_module(module="migrations.test_migrations_no_changes"):
call_command("makemigrations", "migrations", merge=False, verbosity=0)
@@ -1046,8 +1048,8 @@ class MakeMigrationsTests(MigrationTestBase):
"migrations.migrations_test_apps.unspecified_app_with_conflict"])
def test_makemigrations_unspecified_app_with_conflict_merge(self):
"""
- Makes sure that makemigrations does not create a merge for an
- unspecified app even if it has conflicting migrations.
+ makemigrations does not create a merge for an unspecified app even if
+ it has conflicting migrations.
"""
# Monkeypatch interactive questioner to auto accept
with mock.patch('django.db.migrations.questioner.input', mock.Mock(return_value='y')):
@@ -1064,8 +1066,8 @@ class MakeMigrationsTests(MigrationTestBase):
"migrations.migrations_test_apps.conflicting_app_with_dependencies"])
def test_makemigrations_merge_dont_output_dependency_operations(self):
"""
- Makes sure that makemigrations --merge does not output any operations
- from apps that don't belong to a given app.
+ makemigrations --merge does not output any operations from apps that
+ don't belong to a given app.
"""
# Monkeypatch interactive questioner to auto accept
with mock.patch('django.db.migrations.questioner.input', mock.Mock(return_value='N')):
@@ -1093,7 +1095,7 @@ class MakeMigrationsTests(MigrationTestBase):
def test_makemigrations_with_custom_name(self):
"""
- Makes sure that makemigrations generate a custom migration.
+ makemigrations --name generate a custom migration name.
"""
with self.temporary_migration_module() as migration_dir:
@@ -1218,7 +1220,7 @@ class SquashMigrationsTests(MigrationTestBase):
def test_squashmigrations_squashes(self):
"""
- Tests that squashmigrations squashes migrations.
+ squashmigrations squashes migrations.
"""
with self.temporary_migration_module(module="migrations.test_migrations") as migration_dir:
call_command("squashmigrations", "migrations", "0002", interactive=False, verbosity=0)
@@ -1237,7 +1239,7 @@ class SquashMigrationsTests(MigrationTestBase):
def test_squashmigrations_optimizes(self):
"""
- Tests that squashmigrations optimizes operations.
+ squashmigrations optimizes operations.
"""
out = six.StringIO()
with self.temporary_migration_module(module="migrations.test_migrations"):
@@ -1246,7 +1248,7 @@ class SquashMigrationsTests(MigrationTestBase):
def test_ticket_23799_squashmigrations_no_optimize(self):
"""
- Makes sure that squashmigrations --no-optimize really doesn't optimize operations.
+ squashmigrations --no-optimize doesn't optimize operations.
"""
out = six.StringIO()
with self.temporary_migration_module(module="migrations.test_migrations"):
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py
index 93651d74bc..01b31a6dae 100644
--- a/tests/migrations/test_executor.py
+++ b/tests/migrations/test_executor.py
@@ -133,7 +133,7 @@ class ExecutorTests(MigrationTestBase):
})
def test_empty_plan(self):
"""
- Tests that re-planning a full migration of a fully-migrated set doesn't
+ Re-planning a full migration of a fully-migrated set doesn't
perform spurious unmigrations and remigrations.
There was previously a bug where the executor just always performed the
@@ -404,7 +404,7 @@ class ExecutorTests(MigrationTestBase):
)
def test_unrelated_model_lookups_forwards(self):
"""
- #24123 - Tests that all models of apps already applied which are
+ #24123 - All models of apps already applied which are
unrelated to the first app being applied are part of the initial model
state.
"""
@@ -449,7 +449,7 @@ class ExecutorTests(MigrationTestBase):
)
def test_unrelated_model_lookups_backwards(self):
"""
- #24123 - Tests that all models of apps being unapplied which are
+ #24123 - All models of apps being unapplied which are
unrelated to the first app being unapplied are part of the initial
model state.
"""
diff --git a/tests/migrations/test_graph.py b/tests/migrations/test_graph.py
index ad7e04581c..26a5f18328 100644
--- a/tests/migrations/test_graph.py
+++ b/tests/migrations/test_graph.py
@@ -285,7 +285,7 @@ class GraphTests(SimpleTestCase):
def test_remove_replaced_nodes(self):
"""
- Tests that replaced nodes are properly removed and dependencies remapped.
+ Replaced nodes are properly removed and dependencies remapped.
"""
# Add some dummy nodes to be replaced.
graph = MigrationGraph()
@@ -328,7 +328,7 @@ class GraphTests(SimpleTestCase):
def test_remove_replacement_node(self):
"""
- Tests that a replacement node is properly removed and child dependencies remapped.
+ A replacement node is properly removed and child dependencies remapped.
We assume parent dependencies are already correct.
"""
# Add some dummy nodes to be replaced.
diff --git a/tests/migrations/test_multidb.py b/tests/migrations/test_multidb.py
index 0d7ea92ef5..c6ca4a844e 100644
--- a/tests/migrations/test_multidb.py
+++ b/tests/migrations/test_multidb.py
@@ -49,7 +49,7 @@ class MultiDBOperationTests(OperationTestBase):
def _test_create_model(self, app_label, should_run):
"""
- Tests that CreateModel honours multi-db settings.
+ CreateModel honors multi-db settings.
"""
operation = migrations.CreateModel(
"Pony",
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index cab0caf75a..8a7ccbffc2 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -402,7 +402,7 @@ class OperationTests(OperationTestBase):
def test_create_proxy_model(self):
"""
- Tests that CreateModel ignores proxy models.
+ CreateModel ignores proxy models.
"""
project_state = self.set_up_test_model("test_crprmo")
# Test the state alteration
@@ -436,7 +436,7 @@ class OperationTests(OperationTestBase):
def test_create_unmanaged_model(self):
"""
- Tests that CreateModel ignores unmanaged models.
+ CreateModel ignores unmanaged models.
"""
project_state = self.set_up_test_model("test_crummo")
# Test the state alteration
@@ -465,7 +465,7 @@ class OperationTests(OperationTestBase):
def test_create_model_managers(self):
"""
- Tests that the managers on a model are set.
+ The managers on a model are set.
"""
project_state = self.set_up_test_model("test_cmoma")
# Test the state alteration
@@ -1502,7 +1502,7 @@ class OperationTests(OperationTestBase):
self.assertColumnNotNull("test_alflin_pony", "pink")
with connection.schema_editor() as editor:
operation.database_forwards("test_alflin", editor, project_state, new_state)
- # Ensure that index hasn't been dropped
+ # Index hasn't been dropped
self.assertIndexExists("test_alflin_pony", ["pink"])
# And test reversal
with connection.schema_editor() as editor:
@@ -1563,7 +1563,7 @@ class OperationTests(OperationTestBase):
def test_alter_model_options_emptying(self):
"""
- Tests that the AlterModelOptions operation removes keys from the dict (#23121)
+ The AlterModelOptions operation removes keys from the dict (#23121)
"""
project_state = self.set_up_test_model("test_almoop", options=True)
# Test the state alteration (no DB alteration to test)
@@ -1623,7 +1623,7 @@ class OperationTests(OperationTestBase):
def test_alter_model_managers(self):
"""
- Tests that the managers on a model are set.
+ The managers on a model are set.
"""
project_state = self.set_up_test_model("test_almoma")
# Test the state alteration
@@ -1659,7 +1659,7 @@ class OperationTests(OperationTestBase):
def test_alter_model_managers_emptying(self):
"""
- Tests that the managers on a model are set.
+ The managers on a model are set.
"""
project_state = self.set_up_test_model("test_almomae", manager_model=True)
# Test the state alteration
@@ -1683,7 +1683,7 @@ class OperationTests(OperationTestBase):
def test_alter_fk(self):
"""
- Tests that creating and then altering an FK works correctly
+ Creating and then altering an FK works correctly
and deals with the pending SQL (#23091)
"""
project_state = self.set_up_test_model("test_alfk")
@@ -1710,7 +1710,7 @@ class OperationTests(OperationTestBase):
def test_alter_fk_non_fk(self):
"""
- Tests that altering an FK to a non-FK works (#23244)
+ Altering an FK to a non-FK works (#23244)
"""
# Test the state alteration
operation = migrations.AlterField(
@@ -2013,7 +2013,7 @@ class OperationTests(OperationTestBase):
def test_run_python_related_assignment(self):
"""
- #24282 - Tests that model changes to a FK reverse side update the model
+ #24282 - Model changes to a FK reverse side update the model
on the FK side as well.
"""
@@ -2307,7 +2307,7 @@ class OperationTests(OperationTestBase):
operation.state_forwards(app_label, new_state)
def assertModelsAndTables(after_db):
- # Check that tables and models exist, or don't, as they should:
+ # Tables and models exist, or don't, as they should:
self.assertNotIn((app_label, "somethingelse"), new_state.models)
self.assertEqual(len(new_state.models[app_label, "somethingcompletelydifferent"].fields), 1)
self.assertNotIn((app_label, "iloveponiesonies"), new_state.models)
@@ -2337,7 +2337,7 @@ class OperationTests(OperationTestBase):
class SwappableOperationTests(OperationTestBase):
"""
- Tests that key operations ignore swappable models
+ Key operations ignore swappable models
(we don't want to replicate all of them here, as the functionality
is in a common base class anyway)
"""
@@ -2351,7 +2351,7 @@ class SwappableOperationTests(OperationTestBase):
@override_settings(TEST_SWAP_MODEL="migrations.SomeFakeModel")
def test_create_ignore_swapped(self):
"""
- Tests that the CreateTable operation ignores swapped models.
+ The CreateTable operation ignores swapped models.
"""
operation = migrations.CreateModel(
"Pony",
diff --git a/tests/migrations/test_optimizer.py b/tests/migrations/test_optimizer.py
index 6bf09d0178..4893bf0caa 100644
--- a/tests/migrations/test_optimizer.py
+++ b/tests/migrations/test_optimizer.py
@@ -39,7 +39,7 @@ class OptimizerTests(SimpleTestCase):
def test_single(self):
"""
- Tests that the optimizer does nothing on a single operation,
+ The optimizer does nothing on a single operation,
and that it does it in just one pass.
"""
self.assertOptimizesTo(
@@ -655,9 +655,9 @@ class OptimizerTests(SimpleTestCase):
def test_optimize_through_fields(self):
"""
- Checks that field-level through checking is working.
- This should manage to collapse model Foo to nonexistence,
- and model Bar to a single IntegerField called "width".
+ field-level through checking is working. This should manage to collapse
+ model Foo to nonexistence, and model Bar to a single IntegerField
+ called "width".
"""
self.assertOptimizesTo(
[
diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py
index 9428ea060d..c8eb1726ba 100644
--- a/tests/migrations/test_state.py
+++ b/tests/migrations/test_state.py
@@ -447,7 +447,7 @@ class StateTests(SimpleTestCase):
def test_render_project_dependencies(self):
"""
- Tests that the ProjectState render method correctly renders models
+ The ProjectState render method correctly renders models
to account for inter-model base dependencies.
"""
new_apps = Apps()
@@ -506,7 +506,7 @@ class StateTests(SimpleTestCase):
def test_render_unique_app_labels(self):
"""
- Tests that the ProjectState render method doesn't raise an
+ The ProjectState render method doesn't raise an
ImproperlyConfigured exception about unique labels if two dotted app
names have the same last part.
"""
@@ -557,7 +557,7 @@ class StateTests(SimpleTestCase):
model_a_old = old_state.apps.get_model('something', 'A')
model_b_old = old_state.apps.get_model('something', 'B')
model_c_old = old_state.apps.get_model('something', 'C')
- # Check that the relations between the old models are correct
+ # The relations between the old models are correct
self.assertIs(model_a_old._meta.get_field('b').related_model, model_b_old)
self.assertIs(model_b_old._meta.get_field('a_ptr').related_model, model_a_old)
@@ -571,14 +571,14 @@ class StateTests(SimpleTestCase):
model_b_new = project_state.apps.get_model('something', 'B')
model_c_new = project_state.apps.get_model('something', 'C')
- # Check that all models have changed
+ # All models have changed
self.assertIsNot(model_a_old, model_a_new)
self.assertIsNot(model_b_old, model_b_new)
self.assertIsNot(model_c_old, model_c_new)
- # Check that the relations between the old models still hold
+ # The relations between the old models still hold
self.assertIs(model_a_old._meta.get_field('b').related_model, model_b_old)
self.assertIs(model_b_old._meta.get_field('a_ptr').related_model, model_a_old)
- # Check that the relations between the new models correct
+ # The relations between the new models correct
self.assertIs(model_a_new._meta.get_field('b').related_model, model_b_new)
self.assertIs(model_b_new._meta.get_field('a_ptr').related_model, model_a_new)
self.assertIs(model_a_new._meta.get_field('from_c').related_model, model_c_new)
@@ -586,7 +586,7 @@ class StateTests(SimpleTestCase):
def test_remove_relations(self):
"""
- #24225 - Tests that relations between models are updated while
+ #24225 - Relations between models are updated while
remaining the relations and references for models of an old state.
"""
new_apps = Apps()
@@ -614,7 +614,7 @@ class StateTests(SimpleTestCase):
operation = RemoveField("b", "to_a")
operation.state_forwards("something", project_state)
- # Tests that model from old_state still has the relation
+ # Model from old_state still has the relation
model_a_old = get_model_a(old_state)
model_a_new = get_model_a(project_state)
self.assertIsNot(model_a_old, model_a_new)
@@ -668,7 +668,7 @@ class StateTests(SimpleTestCase):
model_a_new = get_model_a(project_state)
self.assertIsNot(model_a_old, model_a_new)
- # Tests that the old model's _meta is still consistent
+ # The old model's _meta is still consistent
field_to_a_old = model_a_old._meta.get_field("to_a")
self.assertEqual(field_to_a_old.m2m_field_name(), "from_a")
self.assertEqual(field_to_a_old.m2m_reverse_field_name(), "to_a")
@@ -676,7 +676,7 @@ class StateTests(SimpleTestCase):
self.assertIs(field_to_a_old.remote_field.through._meta.get_field('to_a').related_model, model_a_old)
self.assertIs(field_to_a_old.remote_field.through._meta.get_field('from_a').related_model, model_a_old)
- # Tests that the new model's _meta is still consistent
+ # The new model's _meta is still consistent
field_to_a_new = model_a_new._meta.get_field("to_a")
self.assertEqual(field_to_a_new.m2m_field_name(), "from_a")
self.assertEqual(field_to_a_new.m2m_reverse_field_name(), "to_a")
@@ -686,9 +686,8 @@ class StateTests(SimpleTestCase):
def test_equality(self):
"""
- Tests that == and != are implemented correctly.
+ == and != are implemented correctly.
"""
-
# Test two things that should be equal
project_state = ProjectState()
project_state.add_model(ModelState(
@@ -807,7 +806,7 @@ class StateTests(SimpleTestCase):
def test_real_apps(self):
"""
- Tests that including real apps can resolve dangling FK errors.
+ Including real apps can resolve dangling FK errors.
This test relies on the fact that contenttypes is always loaded.
"""
new_apps = Apps()
@@ -867,7 +866,7 @@ class StateTests(SimpleTestCase):
def test_manager_refer_correct_model_version(self):
"""
- #24147 - Tests that managers refer to the correct version of a
+ #24147 - Managers refer to the correct version of a
historical model
"""
project_state = ProjectState()
@@ -962,7 +961,7 @@ class ModelStateTests(SimpleTestCase):
def test_fields_immutability(self):
"""
- Tests that rendering a model state doesn't alter its internal fields.
+ Rendering a model state doesn't alter its internal fields.
"""
apps = Apps()
field = models.CharField(max_length=1)
diff --git a/tests/model_fields/test_charfield.py b/tests/model_fields/test_charfield.py
index 82c7848777..0bca108d22 100644
--- a/tests/model_fields/test_charfield.py
+++ b/tests/model_fields/test_charfield.py
@@ -26,7 +26,7 @@ class TestCharField(TestCase):
def test_lookup_integer_in_charfield(self):
self.assertEqual(Post.objects.filter(title=9).count(), 0)
- @skipIf(connection.vendor == 'mysql', 'See https://code.djangoproject.com/ticket/18392')
+ @skipIf(connection.vendor == 'mysql', 'Running on MySQL requires utf8mb4 encoding (#18392)')
def test_emoji(self):
p = Post.objects.create(title='Smile 😀', body='Whatever.')
p.refresh_from_db()
diff --git a/tests/model_fields/test_imagefield.py b/tests/model_fields/test_imagefield.py
index a70394795f..e178760d2f 100644
--- a/tests/model_fields/test_imagefield.py
+++ b/tests/model_fields/test_imagefield.py
@@ -179,8 +179,8 @@ class ImageFieldTests(ImageFieldTestMixin, TestCase):
def test_pickle(self):
"""
- Tests that ImageField can be pickled, unpickled, and that the
- image of the unpickled version is the same as the original.
+ ImageField can be pickled, unpickled, and that the image of
+ the unpickled version is the same as the original.
"""
import pickle
@@ -242,7 +242,7 @@ class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase):
def test_default_value(self):
"""
- Tests that the default value for an ImageField is an instance of
+ The default value for an ImageField is an instance of
the field's attr_class (TestImageFieldFile in this case) with no
name (name set to None).
"""
@@ -252,7 +252,7 @@ class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase):
def test_assignment_to_None(self):
"""
- Tests that assigning ImageField to None clears dimensions.
+ Assigning ImageField to None clears dimensions.
"""
p = self.PersonModel(name='Joe', mugshot=self.file1)
self.check_dimensions(p, 4, 8)
@@ -284,7 +284,7 @@ class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase):
def test_dimensions(self):
"""
- Checks that dimensions are updated correctly in various situations.
+ Dimensions are updated correctly in various situations.
"""
p = self.PersonModel(name='Joe')
@@ -417,7 +417,7 @@ class TwoImageFieldTests(ImageFieldTestMixin, TestCase):
def test_dimensions(self):
"""
- Checks that dimensions are updated correctly in various situations.
+ Dimensions are updated correctly in various situations.
"""
p = self.PersonModel(name='Joe')
diff --git a/tests/model_fields/test_textfield.py b/tests/model_fields/test_textfield.py
index e1d751f1be..a3cd516cb4 100644
--- a/tests/model_fields/test_textfield.py
+++ b/tests/model_fields/test_textfield.py
@@ -29,7 +29,7 @@ class TextFieldTests(TestCase):
def test_lookup_integer_in_textfield(self):
self.assertEqual(Post.objects.filter(body=24).count(), 0)
- @skipIf(connection.vendor == 'mysql', 'See https://code.djangoproject.com/ticket/18392')
+ @skipIf(connection.vendor == 'mysql', 'Running on MySQL requires utf8mb4 encoding (#18392)')
def test_emoji(self):
p = Post.objects.create(title='Whatever', body='Smile 😀.')
p.refresh_from_db()
diff --git a/tests/model_fields/test_uuid.py b/tests/model_fields/test_uuid.py
index 1e032ce9b0..5c87e4b0af 100644
--- a/tests/model_fields/test_uuid.py
+++ b/tests/model_fields/test_uuid.py
@@ -128,7 +128,7 @@ class TestAsPrimaryKey(TestCase):
u1 = PrimaryKeyUUIDModel()
u2 = PrimaryKeyUUIDModel(id=None)
PrimaryKeyUUIDModel.objects.bulk_create([u1, u2])
- # Check that the two objects were correctly created.
+ # The two objects were correctly created.
u1_found = PrimaryKeyUUIDModel.objects.filter(id=u1.id).exists()
u2_found = PrimaryKeyUUIDModel.objects.exclude(id=u1.id).exists()
self.assertTrue(u1_found)
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index 289d8604b3..d1c5b00d8a 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -1829,8 +1829,7 @@ class ModelMultipleChoiceFieldTests(TestCase):
def test_model_multiple_choice_number_of_queries(self):
"""
- Test that ModelMultipleChoiceField does O(1) queries instead of
- O(n) (#10156).
+ ModelMultipleChoiceField does O(1) queries instead of O(n) (#10156).
"""
persons = [Writer.objects.create(name="Person %s" % i) for i in range(30)]
@@ -1839,7 +1838,7 @@ class ModelMultipleChoiceFieldTests(TestCase):
def test_model_multiple_choice_run_validators(self):
"""
- Test that ModelMultipleChoiceField run given validators (#14144).
+ ModelMultipleChoiceField run given validators (#14144).
"""
for i in range(30):
Writer.objects.create(name="Person %s" % i)
@@ -2779,8 +2778,10 @@ class ModelFormInheritanceTests(SimpleTestCase):
self.assertEqual(list(type(str('NewForm'), (ModelForm, Form), {'age': None})().fields.keys()), ['name'])
def test_field_removal_name_clashes(self):
- """Regression test for https://code.djangoproject.com/ticket/22510."""
-
+ """
+ Form fields can be removed in subclasses by setting them to None
+ (#22510).
+ """
class MyForm(forms.ModelForm):
media = forms.CharField()
@@ -2898,8 +2899,7 @@ class FormFieldCallbackTests(SimpleTestCase):
self.assertEqual(list(form.base_fields), ["name"])
def test_custom_callback(self):
- """Test that a custom formfield_callback is used if provided"""
-
+ """A custom formfield_callback is used if provided"""
callback_args = []
def callback(db_field, **kwargs):
@@ -2917,8 +2917,7 @@ class FormFieldCallbackTests(SimpleTestCase):
modelform_factory(Person, form=BaseForm, formfield_callback=callback)
id_field, name_field = Person._meta.fields
- self.assertEqual(callback_args,
- [(id_field, {}), (name_field, {'widget': widget})])
+ self.assertEqual(callback_args, [(id_field, {}), (name_field, {'widget': widget})])
def test_bad_callback(self):
# A bad callback provided by user still gives an error
diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py
index 43a5b9526e..fc0dff8304 100644
--- a/tests/model_formsets/tests.py
+++ b/tests/model_formsets/tests.py
@@ -485,8 +485,9 @@ class ModelFormsetTest(TestCase):
self.assertEqual(poet2.name, 'Vladimir Mayakovsky')
def test_custom_form(self):
- """ Test that model_formset respects fields and exclude parameters of
- custom form
+ """
+ model_formset_factory() respects fields and exclude parameters of a
+ custom form.
"""
class PostForm1(forms.ModelForm):
class Meta:
@@ -508,8 +509,7 @@ class ModelFormsetTest(TestCase):
def test_custom_queryset_init(self):
"""
- Test that a queryset can be overridden in the __init__ method.
- https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#changing-the-queryset
+ A queryset can be overridden in the formset's __init__() method.
"""
Author.objects.create(name='Charles Baudelaire')
Author.objects.create(name='Paul Verlaine')
diff --git a/tests/model_inheritance/tests.py b/tests/model_inheritance/tests.py
index 657e8fa297..079fbb75c4 100644
--- a/tests/model_inheritance/tests.py
+++ b/tests/model_inheritance/tests.py
@@ -109,9 +109,8 @@ class ModelInheritanceTests(TestCase):
def test_update_parent_filtering(self):
"""
- Test that updating a field of a model subclass doesn't issue an UPDATE
- query constrained by an inner query.
- Refs #10399
+ Updating a field of a model subclass doesn't issue an UPDATE
+ query constrained by an inner query (#10399).
"""
supplier = Supplier.objects.create(
name='Central market',
@@ -336,12 +335,12 @@ class ModelInheritanceDataTests(TestCase):
qs = (Restaurant.objects.select_related("italianrestaurant")
.defer("italianrestaurant__serves_gnocchi").order_by("rating"))
- # Test that the field was actually deferred
+ # The field was actually deferred
with self.assertNumQueries(2):
objs = list(qs.all())
self.assertTrue(objs[1].italianrestaurant.serves_gnocchi)
- # Test that model fields where assigned correct values
+ # Model fields where assigned correct values
self.assertEqual(qs[0].name, 'Demon Dogs')
self.assertEqual(qs[0].rating, 2)
self.assertEqual(qs[1].italianrestaurant.name, 'Ristorante Miron')
@@ -349,8 +348,7 @@ class ModelInheritanceDataTests(TestCase):
def test_update_query_counts(self):
"""
- Test that update queries do not generate non-necessary queries.
- Refs #18304.
+ Update queries do not generate unnecessary queries (#18304).
"""
with self.assertNumQueries(3):
self.italian_restaurant.save()
diff --git a/tests/model_inheritance_regress/models.py b/tests/model_inheritance_regress/models.py
index b5bc75061d..07d5a22c9b 100644
--- a/tests/model_inheritance_regress/models.py
+++ b/tests/model_inheritance_regress/models.py
@@ -167,7 +167,7 @@ class InternalCertificationAudit(CertificationAudit):
auditing_dept = models.CharField(max_length=20)
-# Check that abstract classes don't get m2m tables autocreated.
+# Abstract classes don't get m2m tables autocreated.
@python_2_unicode_compatible
class Person(models.Model):
name = models.CharField(max_length=100)
diff --git a/tests/model_inheritance_regress/tests.py b/tests/model_inheritance_regress/tests.py
index 5299739b08..3664fca44f 100644
--- a/tests/model_inheritance_regress/tests.py
+++ b/tests/model_inheritance_regress/tests.py
@@ -22,10 +22,10 @@ from .models import (
class ModelInheritanceTest(TestCase):
def test_model_inheritance(self):
# Regression for #7350, #7202
- # Check that when you create a Parent object with a specific reference
- # to an existent child instance, saving the Parent doesn't duplicate
- # the child. This behavior is only activated during a raw save - it
- # is mostly relevant to deserialization, but any sort of CORBA style
+ # When you create a Parent object with a specific reference to an
+ # existent child instance, saving the Parent doesn't duplicate the
+ # child. This behavior is only activated during a raw save - it is
+ # mostly relevant to deserialization, but any sort of CORBA style
# 'narrow()' API would require a similar approach.
# Create a child-parent-grandparent chain
@@ -49,7 +49,7 @@ class ModelInheritanceTest(TestCase):
park = ParkingLot(parent=place2, capacity=100)
park.save_base(raw=True)
- # Check that no extra parent objects have been created.
+ # No extra parent objects have been created.
places = list(Place.objects.all())
self.assertEqual(places, [place1, place2])
@@ -325,8 +325,8 @@ class ModelInheritanceTest(TestCase):
assignee="adrian")
def test_abstract_base_class_m2m_relation_inheritance(self):
- # Check that many-to-many relations defined on an abstract base class
- # are correctly inherited (and created) on the child class.
+ # many-to-many relations defined on an abstract base class are
+ # correctly inherited (and created) on the child class.
p1 = Person.objects.create(name='Alice')
p2 = Person.objects.create(name='Bob')
p3 = Person.objects.create(name='Carol')
@@ -348,8 +348,8 @@ class ModelInheritanceTest(TestCase):
parties = list(p2.bachelorparty_set.all())
self.assertEqual(parties, [bachelor])
- # Check that a subclass of a subclass of an abstract model doesn't get
- # its own accessor.
+ # A subclass of a subclass of an abstract model doesn't get its own
+ # accessor.
self.assertFalse(hasattr(p2, 'messybachelorparty_set'))
# ... but it does inherit the m2m from its parent
@@ -410,8 +410,8 @@ class ModelInheritanceTest(TestCase):
def test_inherited_unique_field_with_form(self):
"""
- Test that a model which has different primary key for the parent model
- passes unique field checking correctly. Refs #17615.
+ A model which has different primary key for the parent model passes
+ unique field checking correctly (#17615).
"""
class ProfileForm(forms.ModelForm):
class Meta:
@@ -420,8 +420,7 @@ class ModelInheritanceTest(TestCase):
User.objects.create(username="user_only")
p = Profile.objects.create(username="user_with_profile")
- form = ProfileForm({'username': "user_with_profile", 'extra': "hello"},
- instance=p)
+ form = ProfileForm({'username': "user_with_profile", 'extra': "hello"}, instance=p)
self.assertTrue(form.is_valid())
def test_inheritance_joins(self):
@@ -441,10 +440,7 @@ class ModelInheritanceTest(TestCase):
self.assertEqual(str(qs.query).count('JOIN'), 1)
def test_issue_21554(self):
- senator = Senator.objects.create(
- name='John Doe', title='X', state='Y'
- )
-
+ senator = Senator.objects.create(name='John Doe', title='X', state='Y')
senator = Senator.objects.get(pk=senator.pk)
self.assertEqual(senator.name, 'John Doe')
self.assertEqual(senator.title, 'X')
diff --git a/tests/model_regress/tests.py b/tests/model_regress/tests.py
index 23390c0d81..3990143e2d 100644
--- a/tests/model_regress/tests.py
+++ b/tests/model_regress/tests.py
@@ -159,18 +159,12 @@ class ModelTests(TestCase):
)
def test_get_next_prev_by_field(self):
- # Check that get_next_by_FIELD and get_previous_by_FIELD don't crash
- # when we have usecs values stored on the database
- #
- # It crashed after the Field.get_db_prep_* refactor, because on most
- # backends DateTimeFields supports usecs, but DateTimeField.to_python
- # didn't recognize them. (Note that
- # Model._get_next_or_previous_by_FIELD coerces values to strings)
+ # get_next_by_FIELD() and get_previous_by_FIELD() don't crash when
+ # microseconds values are stored in the database.
Event.objects.create(when=datetime.datetime(2000, 1, 1, 16, 0, 0))
Event.objects.create(when=datetime.datetime(2000, 1, 1, 6, 1, 1))
Event.objects.create(when=datetime.datetime(2000, 1, 1, 13, 1, 1))
e = Event.objects.create(when=datetime.datetime(2000, 1, 1, 12, 0, 20, 24))
-
self.assertEqual(
e.get_next_by_when().when, datetime.datetime(2000, 1, 1, 13, 1, 1)
)
@@ -243,7 +237,7 @@ class EvaluateMethodTest(TestCase):
def test_model_with_evaluate_method(self):
"""
- Ensures that you can filter by objects that have an 'evaluate' attr
+ You can filter by objects that have an 'evaluate' attr
"""
dept = Department.objects.create(pk=1, name='abc')
dept.evaluate = 'abc'
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py
index e2f565ad9d..c9bbfc8d0e 100644
--- a/tests/modeladmin/tests.py
+++ b/tests/modeladmin/tests.py
@@ -67,9 +67,7 @@ class ModelAdminTests(TestCase):
self.assertEqual(ma.get_fieldsets(request, self.band), [(None, {'fields': ['name', 'bio', 'sign_date']})])
def test_get_fieldsets(self):
- # Test that get_fieldsets is called when figuring out form fields.
- # Refs #18681.
-
+ # get_fieldsets() is called when figuring out form fields (#18681).
class BandAdmin(ModelAdmin):
def get_fieldsets(self, request, obj=None):
return [(None, {'fields': ['name', 'bio']})]
@@ -92,9 +90,8 @@ class ModelAdminTests(TestCase):
def test_lookup_allowed_allows_nonexistent_lookup(self):
"""
- Ensure that a lookup_allowed allows a parameter
- whose field lookup doesn't exist.
- Refs #21129.
+ A lookup_allowed allows a parameter whose field lookup doesn't exist.
+ (#21129).
"""
class BandAdmin(ModelAdmin):
fields = ['name']
@@ -162,13 +159,11 @@ class ModelAdminTests(TestCase):
def test_custom_form_meta_exclude_with_readonly(self):
"""
- Ensure that the custom ModelForm's `Meta.exclude` is respected when
- used in conjunction with `ModelAdmin.readonly_fields` and when no
- `ModelAdmin.exclude` is defined.
- Refs #14496.
+ The custom ModelForm's `Meta.exclude` is respected when used in
+ conjunction with `ModelAdmin.readonly_fields` and when no
+ `ModelAdmin.exclude` is defined (#14496).
"""
# First, with `ModelAdmin` -----------------------
-
class AdminBandForm(forms.ModelForm):
class Meta:
model = Band
@@ -182,7 +177,6 @@ class ModelAdminTests(TestCase):
self.assertEqual(list(ma.get_form(request).base_fields), ['sign_date'])
# Then, with `InlineModelAdmin` -----------------
-
class AdminConcertForm(forms.ModelForm):
class Meta:
model = Concert
@@ -237,12 +231,10 @@ class ModelAdminTests(TestCase):
def test_custom_form_meta_exclude(self):
"""
- Ensure that the custom ModelForm's `Meta.exclude` is overridden if
- `ModelAdmin.exclude` or `InlineModelAdmin.exclude` are defined.
- Refs #14496.
+ The custom ModelForm's `Meta.exclude` is overridden if
+ `ModelAdmin.exclude` or `InlineModelAdmin.exclude` are defined (#14496).
"""
# First, with `ModelAdmin` -----------------------
-
class AdminBandForm(forms.ModelForm):
class Meta:
model = Band
@@ -256,7 +248,6 @@ class ModelAdminTests(TestCase):
self.assertEqual(list(ma.get_form(request).base_fields), ['bio', 'sign_date'])
# Then, with `InlineModelAdmin` -----------------
-
class AdminConcertForm(forms.ModelForm):
class Meta:
@@ -330,8 +321,8 @@ class ModelAdminTests(TestCase):
def test_form_exclude_kwarg_override(self):
"""
- Ensure that the `exclude` kwarg passed to `ModelAdmin.get_form()`
- overrides all other declarations. Refs #8999.
+ The `exclude` kwarg passed to `ModelAdmin.get_form()` overrides all
+ other declarations (#8999).
"""
class AdminBandForm(forms.ModelForm):
@@ -352,8 +343,8 @@ class ModelAdminTests(TestCase):
def test_formset_exclude_kwarg_override(self):
"""
- Ensure that the `exclude` kwarg passed to `InlineModelAdmin.get_formset()`
- overrides all other declarations. Refs #8999.
+ The `exclude` kwarg passed to `InlineModelAdmin.get_formset()`
+ overrides all other declarations (#8999).
"""
class AdminConcertForm(forms.ModelForm):
@@ -471,7 +462,7 @@ class ModelAdminTests(TestCase):
def test_regression_for_ticket_15820(self):
"""
- Ensure that `obj` is passed from `InlineModelAdmin.get_fieldsets()` to
+ `obj` is passed from `InlineModelAdmin.get_fieldsets()` to
`InlineModelAdmin.get_formset()`.
"""
class CustomConcertForm(forms.ModelForm):
@@ -1709,8 +1700,8 @@ class ModelAdminPermissionTests(SimpleTestCase):
def test_has_add_permission(self):
"""
- Ensure that has_add_permission returns True for users who can add
- objects and False for users who can't.
+ has_add_permission returns True for users who can add objects and
+ False for users who can't.
"""
ma = ModelAdmin(Band, AdminSite())
request = MockRequest()
@@ -1723,8 +1714,8 @@ class ModelAdminPermissionTests(SimpleTestCase):
def test_has_change_permission(self):
"""
- Ensure that has_change_permission returns True for users who can edit
- objects and False for users who can't.
+ has_change_permission returns True for users who can edit objects and
+ False for users who can't.
"""
ma = ModelAdmin(Band, AdminSite())
request = MockRequest()
@@ -1737,8 +1728,8 @@ class ModelAdminPermissionTests(SimpleTestCase):
def test_has_delete_permission(self):
"""
- Ensure that has_delete_permission returns True for users who can delete
- objects and False for users who can't.
+ has_delete_permission returns True for users who can delete objects and
+ False for users who can't.
"""
ma = ModelAdmin(Band, AdminSite())
request = MockRequest()
@@ -1751,8 +1742,8 @@ class ModelAdminPermissionTests(SimpleTestCase):
def test_has_module_permission(self):
"""
- Ensure that has_module_permission returns True for users who have any
- permission for the module and False for users who don't.
+ as_module_permission returns True for users who have any permission
+ for the module and False for users who don't.
"""
ma = ModelAdmin(Band, AdminSite())
request = MockRequest()
diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py
index 5a7b69483f..0a70b20dad 100644
--- a/tests/multiple_database/tests.py
+++ b/tests/multiple_database/tests.py
@@ -21,7 +21,7 @@ class QueryTestCase(TestCase):
multi_db = True
def test_db_selection(self):
- "Check that querysets will use the default database by default"
+ "Querysets will use the default database by default"
self.assertEqual(Book.objects.db, DEFAULT_DB_ALIAS)
self.assertEqual(Book.objects.all().db, DEFAULT_DB_ALIAS)
@@ -41,7 +41,7 @@ class QueryTestCase(TestCase):
dive.published = datetime.date(2009, 5, 4)
dive.save()
- # Check that book exists on the default database, but not on other database
+ # Book exists on the default database, but not on other database
try:
Book.objects.get(title="Pro Django")
Book.objects.using('default').get(title="Pro Django")
@@ -72,7 +72,7 @@ class QueryTestCase(TestCase):
dive.published = datetime.date(2009, 5, 4)
dive.save(using='other')
- # Check that book exists on the default database, but not on other database
+ # Book exists on the default database, but not on other database
try:
Book.objects.using('other').get(title="Pro Django")
except Book.DoesNotExist:
@@ -162,7 +162,7 @@ class QueryTestCase(TestCase):
self.assertEqual(Book.authors.through.objects.using('default').count(), 1)
self.assertEqual(Book.authors.through.objects.using('other').count(), 1)
- # Check that queries work across m2m joins
+ # Queries work across m2m joins
self.assertEqual(
list(Book.objects.using('default').filter(authors__name='Marty Alchin').values_list('title', flat=True)),
['Pro Django']
@@ -428,7 +428,7 @@ class QueryTestCase(TestCase):
dive = Book.objects.using('other').get(title="Dive into Python")
self.assertEqual(dive.editor.name, "Chris Mills")
- # Check that queries work across foreign key joins
+ # Queries work across foreign key joins
self.assertEqual(
list(Person.objects.using('default').filter(edited__title='Pro Django').values_list('name', flat=True)),
['George Vilches']
@@ -608,7 +608,7 @@ class QueryTestCase(TestCase):
bob = User.objects.using('other').get(username="bob")
self.assertEqual(bob.userprofile.flavor, "crunchy frog")
- # Check that queries work across joins
+ # Queries work across joins
self.assertEqual(
list(
User.objects.using('default')
@@ -962,7 +962,7 @@ class RouterTestCase(TestCase):
multi_db = True
def test_db_selection(self):
- "Check that querysets obey the router for db suggestions"
+ "Querysets obey the router for db suggestions"
self.assertEqual(Book.objects.db, 'other')
self.assertEqual(Book.objects.all().db, 'other')
@@ -1047,7 +1047,7 @@ class RouterTestCase(TestCase):
# But the same query issued explicitly at a database will work.
pro = Book.objects.using('default').get(title='Pro Django')
- # Check that the update worked.
+ # The update worked.
self.assertEqual(pro.pages, 200)
# An update query with an explicit using clause will be routed
@@ -1230,7 +1230,7 @@ class RouterTestCase(TestCase):
dive.save(using='other')
mark.save(using='other')
- # Check that we have 2 of both types of object on both databases
+ # We have 2 of both types of object on both databases
self.assertEqual(Book.objects.using('default').count(), 2)
self.assertEqual(Book.objects.using('other').count(), 2)
self.assertEqual(Person.objects.using('default').count(), 2)
@@ -1513,18 +1513,18 @@ class AuthTestCase(TestCase):
self.assertEqual(User.objects.using('other').count(), 1)
def test_dumpdata(self):
- "Check that dumpdata honors allow_migrate restrictions on the router"
+ "dumpdata honors allow_migrate restrictions on the router"
User.objects.create_user('alice', 'alice@example.com')
User.objects.db_manager('default').create_user('bob', 'bob@example.com')
- # Check that dumping the default database doesn't try to include auth
- # because allow_migrate prohibits auth on default
+ # dumping the default database doesn't try to include auth because
+ # allow_migrate prohibits auth on default
new_io = StringIO()
management.call_command('dumpdata', 'auth', format='json', database='default', stdout=new_io)
command_output = new_io.getvalue().strip()
self.assertEqual(command_output, '[]')
- # Check that dumping the other database does include auth
+ # dumping the other database does include auth
new_io = StringIO()
management.call_command('dumpdata', 'auth', format='json', database='other', stdout=new_io)
command_output = new_io.getvalue().strip()
@@ -1549,14 +1549,14 @@ class FixtureTestCase(TestCase):
@override_settings(DATABASE_ROUTERS=[AntiPetRouter()])
def test_fixture_loading(self):
"Multi-db fixtures are loaded correctly"
- # Check that "Pro Django" exists on the default database, but not on other database
+ # "Pro Django" exists on the default database, but not on other database
Book.objects.get(title="Pro Django")
Book.objects.using('default').get(title="Pro Django")
with self.assertRaises(Book.DoesNotExist):
Book.objects.using('other').get(title="Pro Django")
- # Check that "Dive into Python" exists on the default database, but not on other database
+ # "Dive into Python" exists on the default database, but not on other database
Book.objects.using('other').get(title="Dive into Python")
with self.assertRaises(Book.DoesNotExist):
@@ -1564,7 +1564,7 @@ class FixtureTestCase(TestCase):
with self.assertRaises(Book.DoesNotExist):
Book.objects.using('default').get(title="Dive into Python")
- # Check that "Definitive Guide" exists on the both databases
+ # "Definitive Guide" exists on the both databases
Book.objects.get(title="The Definitive Guide to Django")
Book.objects.using('default').get(title="The Definitive Guide to Django")
Book.objects.using('other').get(title="The Definitive Guide to Django")
@@ -1616,8 +1616,7 @@ class SignalTests(TestCase):
def test_database_arg_save_and_delete(self):
"""
- Tests that the pre/post_save signal contains the correct database.
- (#13552)
+ The pre/post_save signal contains the correct database.
"""
# Make some signal receivers
pre_save_receiver = DatabaseReceiver()
@@ -1654,7 +1653,7 @@ class SignalTests(TestCase):
def test_database_arg_m2m(self):
"""
- Test that the m2m_changed signal has a correct database arg (#13552)
+ The m2m_changed signal has a correct database arg.
"""
# Make a receiver
receiver = DatabaseReceiver()
@@ -1717,7 +1716,7 @@ class RouterAttributeErrorTestCase(TestCase):
return override_settings(DATABASE_ROUTERS=[AttributeErrorRouter()])
def test_attribute_error_read(self):
- "Check that the AttributeError from AttributeErrorRouter bubbles up"
+ "The AttributeError from AttributeErrorRouter bubbles up"
b = Book.objects.create(title="Pro Django",
published=datetime.date(2008, 12, 16))
with self.override_router():
@@ -1725,7 +1724,7 @@ class RouterAttributeErrorTestCase(TestCase):
Book.objects.get(pk=b.pk)
def test_attribute_error_save(self):
- "Check that the AttributeError from AttributeErrorRouter bubbles up"
+ "The AttributeError from AttributeErrorRouter bubbles up"
dive = Book()
dive.title = "Dive into Python"
dive.published = datetime.date(2009, 5, 4)
@@ -1734,7 +1733,7 @@ class RouterAttributeErrorTestCase(TestCase):
dive.save()
def test_attribute_error_delete(self):
- "Check that the AttributeError from AttributeErrorRouter bubbles up"
+ "The AttributeError from AttributeErrorRouter bubbles up"
b = Book.objects.create(title="Pro Django",
published=datetime.date(2008, 12, 16))
p = Person.objects.create(name="Marty Alchin")
@@ -1745,7 +1744,7 @@ class RouterAttributeErrorTestCase(TestCase):
b.delete()
def test_attribute_error_m2m(self):
- "Check that the AttributeError from AttributeErrorRouter bubbles up"
+ "The AttributeError from AttributeErrorRouter bubbles up"
b = Book.objects.create(title="Pro Django",
published=datetime.date(2008, 12, 16))
p = Person.objects.create(name="Marty Alchin")
diff --git a/tests/no_models/tests.py b/tests/no_models/tests.py
index de2d854006..d5661e09c7 100644
--- a/tests/no_models/tests.py
+++ b/tests/no_models/tests.py
@@ -5,6 +5,6 @@ from django.test import SimpleTestCase
class NoModelTests(SimpleTestCase):
def test_no_models(self):
- """Test that it's possible to load an app with no models.py file."""
+ """It's possible to load an app with no models.py file."""
app_config = apps.get_app_config('no_models')
self.assertIsNone(app_config.models_module)
diff --git a/tests/one_to_one/tests.py b/tests/one_to_one/tests.py
index 3f424b47b8..1bbf85c193 100644
--- a/tests/one_to_one/tests.py
+++ b/tests/one_to_one/tests.py
@@ -165,10 +165,8 @@ class OneToOneTests(TestCase):
def test_create_models_m2m(self):
"""
- Regression test for #1064 and #1506
-
- Check that we create models via the m2m relation if the remote model
- has a OneToOneField.
+ Modles are created via the m2m relation if the remote model has a
+ OneToOneField (#1064, #1506).
"""
f = Favorites(name='Fred')
f.save()
@@ -180,9 +178,7 @@ class OneToOneTests(TestCase):
def test_reverse_object_cache(self):
"""
- Regression test for #7173
-
- Check that the name of the cache for the reverse object is correct.
+ The name of the cache for the reverse object is correct (#7173).
"""
self.assertEqual(self.p1.restaurant, self.r1)
self.assertEqual(self.p1.bar, self.b1)
@@ -516,11 +512,11 @@ class OneToOneTests(TestCase):
def test_rel_pk_subquery(self):
r = Restaurant.objects.first()
q1 = Restaurant.objects.filter(place_id=r.pk)
- # Test that subquery using primary key and a query against the
+ # Subquery using primary key and a query against the
# same model works correctly.
q2 = Restaurant.objects.filter(place_id__in=q1)
self.assertSequenceEqual(q2, [r])
- # Test that subquery using 'pk__in' instead of 'place_id__in' work, too.
+ # Subquery using 'pk__in' instead of 'place_id__in' work, too.
q2 = Restaurant.objects.filter(
pk__in=Restaurant.objects.filter(place__id=r.place.pk)
)
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py
index c07034e0cb..5e9f6dc986 100644
--- a/tests/ordering/tests.py
+++ b/tests/ordering/tests.py
@@ -210,8 +210,7 @@ class OrderingTests(TestCase):
def test_order_by_pk(self):
"""
- Ensure that 'pk' works as an ordering option in Meta.
- Refs #8291.
+ 'pk' works as an ordering option in Meta.
"""
Author.objects.create(pk=1)
Author.objects.create(pk=2)
@@ -227,9 +226,8 @@ class OrderingTests(TestCase):
def test_order_by_fk_attname(self):
"""
- Ensure that ordering by a foreign key by its attribute name prevents
- the query from inheriting its related model ordering option.
- Refs #19195.
+ ordering by a foreign key by its attribute name prevents the query
+ from inheriting its related model ordering option (#19195).
"""
for i in range(1, 5):
author = Author.objects.create(pk=i)
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py
index cc063c9eb8..888cb813b0 100644
--- a/tests/pagination/tests.py
+++ b/tests/pagination/tests.py
@@ -113,8 +113,7 @@ class PaginationTests(unittest.TestCase):
def test_invalid_page_number(self):
"""
- Tests that invalid page numbers result in the correct exception being
- raised.
+ Invalid page numbers result in the correct exception being raised.
"""
paginator = Paginator([1, 2, 3], 2)
with self.assertRaises(InvalidPage):
@@ -165,7 +164,7 @@ class PaginationTests(unittest.TestCase):
def test_page_indexes(self):
"""
- Tests that paginator pages have the correct start and end indexes.
+ Paginator pages have the correct start and end indexes.
"""
ten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
tests = (
@@ -215,7 +214,7 @@ class PaginationTests(unittest.TestCase):
def test_page_sequence(self):
"""
- Tests that a paginator page acts like a standard sequence.
+ A paginator page acts like a standard sequence.
"""
eleven = 'abcdefghijk'
page2 = Paginator(eleven, per_page=5, orphans=1).page(2)
@@ -227,7 +226,7 @@ class PaginationTests(unittest.TestCase):
def test_get_page_hook(self):
"""
- Tests that a Paginator subclass can use the ``_get_page`` hook to
+ A Paginator subclass can use the ``_get_page`` hook to
return an alternative to the standard Page class.
"""
eleven = 'abcdefghijk'
diff --git a/tests/postgres_tests/test_unaccent.py b/tests/postgres_tests/test_unaccent.py
index 9d9a954be9..e1e4171062 100644
--- a/tests/postgres_tests/test_unaccent.py
+++ b/tests/postgres_tests/test_unaccent.py
@@ -29,8 +29,8 @@ class UnaccentTest(PostgreSQLTestCase):
def test_unaccent_chained(self):
"""
- Check that unaccent can be used chained with a lookup (which should be
- the case since unaccent implements the Transform API)
+ Unaccent can be used chained with a lookup (which should be the case
+ since unaccent implements the Transform API)
"""
self.assertQuerysetEqual(
self.Model.objects.filter(field__unaccent__iexact="aeO"),
diff --git a/tests/prefetch_related/test_prefetch_related_objects.py b/tests/prefetch_related/test_prefetch_related_objects.py
index db82fe88f7..6a53d33f6b 100644
--- a/tests/prefetch_related/test_prefetch_related_objects.py
+++ b/tests/prefetch_related/test_prefetch_related_objects.py
@@ -70,9 +70,7 @@ class PrefetchRelatedObjectsTests(TestCase):
[list(book.first_time_authors.all()) for book in books]
def test_m2m_then_m2m(self):
- """
- We can follow a m2m and another m2m.
- """
+ """A m2m can be followed through another m2m."""
authors = list(Author.objects.all())
with self.assertNumQueries(2):
prefetch_related_objects(authors, 'books__read_by')
diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py
index 7c36975084..ee04049f16 100644
--- a/tests/prefetch_related/tests.py
+++ b/tests/prefetch_related/tests.py
@@ -118,18 +118,13 @@ class PrefetchRelatedTests(TestCase):
self.assertIn(qs[0], qs)
def test_clear(self):
- """
- Test that we can clear the behavior by calling prefetch_related()
- """
with self.assertNumQueries(5):
with_prefetch = Author.objects.prefetch_related('books')
without_prefetch = with_prefetch.prefetch_related(None)
[list(a.books.all()) for a in without_prefetch]
def test_m2m_then_m2m(self):
- """
- Test we can follow a m2m and another m2m
- """
+ """A m2m can be followed through another m2m."""
with self.assertNumQueries(3):
qs = Author.objects.prefetch_related('books__read_by')
lists = [[[six.text_type(r) for r in b.read_by.all()]
@@ -168,7 +163,7 @@ class PrefetchRelatedTests(TestCase):
def test_get(self):
"""
- Test that objects retrieved with .get() get the prefetch behavior.
+ Objects retrieved with .get() get the prefetch behavior.
"""
# Need a double
with self.assertNumQueries(3):
@@ -178,8 +173,8 @@ class PrefetchRelatedTests(TestCase):
def test_foreign_key_then_m2m(self):
"""
- Test we can follow an m2m relation after a relation like ForeignKey
- that doesn't have many objects
+ A m2m relation can be followed after a relation like ForeignKey that
+ doesn't have many objects.
"""
with self.assertNumQueries(2):
qs = Author.objects.select_related('first_book').prefetch_related('first_book__read_by')
@@ -189,8 +184,8 @@ class PrefetchRelatedTests(TestCase):
def test_reverse_one_to_one_then_m2m(self):
"""
- Test that we can follow a m2m relation after going through
- the select_related reverse of an o2o.
+ A m2m relation can be followed afterr going through the select_related
+ reverse of an o2o.
"""
qs = Author.objects.prefetch_related('bio__books').select_related('bio')
@@ -832,7 +827,7 @@ class GenericRelationTests(TestCase):
def test_traverse_GFK(self):
"""
- Test that we can traverse a 'content_object' with prefetch_related() and
+ A 'content_object' can be traversed with prefetch_related() and
get to related objects on the other side (assuming it is suitably
filtered)
"""
@@ -1093,7 +1088,7 @@ class NullableTest(TestCase):
boss1 = Employee.objects.create(name="Peter")
boss2 = Employee.objects.create(name="Jack")
with self.assertNumQueries(2):
- # Check that prefetch is done and it does not cause any errors.
+ # Prefetch is done and it does not cause any errors.
bulk = Employee.objects.prefetch_related('serfs').in_bulk([boss1.pk, boss2.pk])
for b in bulk.values():
list(b.serfs.all())
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 5b1f9f6ad1..44bc9c8591 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -890,7 +890,7 @@ class Queries1Tests(TestCase):
def test_ticket17429(self):
"""
- Ensure that Meta.ordering=None works the same as Meta.ordering=[]
+ Meta.ordering=None works the same as Meta.ordering=[]
"""
original_ordering = Tag._meta.ordering
Tag._meta.ordering = None
@@ -1380,9 +1380,8 @@ class Queries4Tests(TestCase):
self.assertEqual(str(q1.query), str(q2.query))
def test_combine_join_reuse(self):
- # Test that we correctly recreate joins having identical connections
- # in the rhs query, in case the query is ORed together. Related to
- # ticket #18748
+ # Joins having identical connections are correctly recreated in the
+ # rhs query, in case the query is ORed together (#18748).
Report.objects.create(name='r4', creator=self.a1)
q1 = Author.objects.filter(report__name='r5')
q2 = Author.objects.filter(report__name='r4').filter(report__name='r1')
@@ -1393,7 +1392,7 @@ class Queries4Tests(TestCase):
def test_ticket7095(self):
# Updates that are filtered on the model being updated are somewhat
- # tricky in MySQL. This exercises that case.
+ # tricky in MySQL.
ManagedModel.objects.create(data='mm1', tag=self.t1, public=True)
self.assertEqual(ManagedModel.objects.update(data='mm'), 1)
@@ -1810,7 +1809,7 @@ class Queries6Tests(TestCase):
Annotation.objects.create(name='a2', tag=t4)
def test_parallel_iterators(self):
- # Test that parallel iterators work.
+ # Parallel iterators work.
qs = Tag.objects.all()
i1, i2 = iter(qs), iter(qs)
self.assertEqual(repr(next(i1)), '')
@@ -2075,7 +2074,7 @@ class CloneTests(TestCase):
def test_no_model_options_cloning(self):
"""
- Test that cloning a queryset does not get out of hand. While complete
+ Cloning a queryset does not get out of hand. While complete
testing is impossible, this is a sanity check against invalid use of
deepcopy. refs #16759.
"""
@@ -2092,7 +2091,7 @@ class CloneTests(TestCase):
def test_no_fields_cloning(self):
"""
- Test that cloning a queryset does not get out of hand. While complete
+ Cloning a queryset does not get out of hand. While complete
testing is impossible, this is a sanity check against invalid use of
deepcopy. refs #16759.
"""
@@ -2538,7 +2537,7 @@ class ConditionalTests(TestCase):
# changing a parameter at compilation time.
@skipUnlessDBFeature('supports_1000_query_parameters')
def test_ticket14244(self):
- # Test that the "in" lookup works with lists of 1000 items or more.
+ # The "in" lookup works with lists of 1000 items or more.
# The numbers amount is picked to force three different IN batches
# for Oracle, yet to be less than 2100 parameter limit for MSSQL.
numbers = list(range(2050))
@@ -2814,7 +2813,7 @@ class NullInExcludeTest(TestCase):
self.assertQuerysetEqual(
NullableName.objects.exclude(name__in=inner_qs),
[none_val], attrgetter('name'))
- # Check that the inner queryset wasn't executed - it should be turned
+ # The inner queryset wasn't executed - it should be turned
# into subquery above
self.assertIs(inner_qs._result_cache, None)
@@ -2840,7 +2839,7 @@ class NullInExcludeTest(TestCase):
class EmptyStringsAsNullTest(TestCase):
"""
- Test that filtering on non-null character fields works as expected.
+ Filtering on non-null character fields works as expected.
The reason for these tests is that Oracle treats '' as NULL, and this
can cause problems in query construction. Refs #17957.
"""
@@ -2871,7 +2870,7 @@ class EmptyStringsAsNullTest(TestCase):
class ProxyQueryCleanupTest(TestCase):
def test_evaluated_proxy_count(self):
"""
- Test that generating the query string doesn't alter the query's state
+ Generating the query string doesn't alter the query's state
in irreversible ways. Refs #18248.
"""
ProxyCategory.objects.create()
@@ -3130,9 +3129,9 @@ class NullJoinPromotionOrTest(TestCase):
class ReverseJoinTrimmingTest(TestCase):
def test_reverse_trimming(self):
- # Check that we don't accidentally trim reverse joins - we can't know
- # if there is anything on the other side of the join, so trimming
- # reverse joins can't be done, ever.
+ # We don't accidentally trim reverse joins - we can't know if there is
+ # anything on the other side of the join, so trimming reverse joins
+ # can't be done, ever.
t = Tag.objects.create()
qs = Tag.objects.filter(annotation__tag=t.pk)
self.assertIn('INNER JOIN', str(qs.query))
@@ -3141,7 +3140,7 @@ class ReverseJoinTrimmingTest(TestCase):
class JoinReuseTest(TestCase):
"""
- Test that the queries reuse joins sensibly (for example, direct joins
+ The queries reuse joins sensibly (for example, direct joins
are always reused).
"""
def test_fk_reuse(self):
@@ -3392,7 +3391,7 @@ class EmptyStringPromotionTests(TestCase):
class ValuesSubqueryTests(TestCase):
def test_values_in_subquery(self):
- # Check that if a values() queryset is used, then the given values
+ # If a values() queryset is used, then the given values
# will be used instead of forcing use of the relation's field.
o1 = Order.objects.create(id=-2)
o2 = Order.objects.create(id=-1)
diff --git a/tests/queryset_pickle/tests.py b/tests/queryset_pickle/tests.py
index 4a28e58da5..86daebfaf9 100644
--- a/tests/queryset_pickle/tests.py
+++ b/tests/queryset_pickle/tests.py
@@ -57,7 +57,7 @@ class PickleabilityTestCase(TestCase):
def test_model_pickle(self):
"""
- Test that a model not defined on module level is picklable.
+ A model not defined on module level is picklable.
"""
original = Container.SomeModel(pk=1)
dumped = pickle.dumps(original)
diff --git a/tests/raw_query/tests.py b/tests/raw_query/tests.py
index 4c791dd206..3388765a98 100644
--- a/tests/raw_query/tests.py
+++ b/tests/raw_query/tests.py
@@ -63,7 +63,7 @@ class RawQueryTests(TestCase):
setattr(orig_item, *annotation)
for field in model._meta.fields:
- # Check that all values on the model are equal
+ # All values on the model are equal
self.assertEqual(
getattr(item, field.attname),
getattr(orig_item, field.attname)
@@ -76,14 +76,13 @@ class RawQueryTests(TestCase):
def assertNoAnnotations(self, results):
"""
- Check that the results of a raw query contain no annotations
+ The results of a raw query contain no annotations
"""
self.assertAnnotations(results, ())
def assertAnnotations(self, results, expected_annotations):
"""
- Check that the passed raw query results contain the expected
- annotations
+ The passed raw query results contain the expected annotations
"""
if expected_annotations:
for index, result in enumerate(results):
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index 2581eada0b..4989071cbb 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -95,9 +95,8 @@ class RequestsTests(SimpleTestCase):
def test_wsgirequest_with_script_name(self):
"""
- Ensure that the request's path is correctly assembled, regardless of
- whether or not the SCRIPT_NAME has a trailing slash.
- Refs #20169.
+ The request's path is correctly assembled, regardless of whether or
+ not the SCRIPT_NAME has a trailing slash (#20169).
"""
# With trailing slash
request = WSGIRequest({
@@ -120,8 +119,7 @@ class RequestsTests(SimpleTestCase):
"""
WSGI squashes multiple successive slashes in PATH_INFO, WSGIRequest
should take that into account when populating request.path and
- request.META['SCRIPT_NAME'].
- Refs #17133.
+ request.META['SCRIPT_NAME'] (#17133).
"""
request = WSGIRequest({
'SCRIPT_URL': '/mst/milestones//accounts/login//help',
@@ -134,9 +132,8 @@ class RequestsTests(SimpleTestCase):
def test_wsgirequest_with_force_script_name(self):
"""
- Ensure that the FORCE_SCRIPT_NAME setting takes precedence over the
- request's SCRIPT_NAME environment parameter.
- Refs #20169.
+ The FORCE_SCRIPT_NAME setting takes precedence over the request's
+ SCRIPT_NAME environment parameter (#20169).
"""
with override_settings(FORCE_SCRIPT_NAME='/FORCED_PREFIX/'):
request = WSGIRequest({
@@ -149,9 +146,8 @@ class RequestsTests(SimpleTestCase):
def test_wsgirequest_path_with_force_script_name_trailing_slash(self):
"""
- Ensure that the request's path is correctly assembled, regardless of
- whether or not the FORCE_SCRIPT_NAME setting has a trailing slash.
- Refs #20169.
+ The request's path is correctly assembled, regardless of whether or not
+ the FORCE_SCRIPT_NAME setting has a trailing slash (#20169).
"""
# With trailing slash
with override_settings(FORCE_SCRIPT_NAME='/FORCED_PREFIX/'):
@@ -250,7 +246,7 @@ class RequestsTests(SimpleTestCase):
datetime_cookie = response.cookies['datetime']
self.assertIn(
datetime_cookie['expires'],
- # Slight time dependency; refs #23450
+ # assertIn accounts for slight time dependency (#23450)
('Sat, 01-Jan-2028 04:05:06 GMT', 'Sat, 01-Jan-2028 04:05:07 GMT')
)
@@ -847,8 +843,8 @@ class BuildAbsoluteURITestCase(SimpleTestCase):
def test_build_absolute_uri_no_location(self):
"""
- Ensures that ``request.build_absolute_uri()`` returns the proper value
- when the ``location`` argument is not provided, and ``request.path``
+ ``request.build_absolute_uri()`` returns the proper value when
+ the ``location`` argument is not provided, and ``request.path``
begins with //.
"""
# //// is needed to create a request with a path beginning with //
@@ -860,9 +856,9 @@ class BuildAbsoluteURITestCase(SimpleTestCase):
def test_build_absolute_uri_absolute_location(self):
"""
- Ensures that ``request.build_absolute_uri()`` returns the proper value
- when an absolute URL ``location`` argument is provided, and
- ``request.path`` begins with //.
+ ``request.build_absolute_uri()`` returns the proper value when
+ an absolute URL ``location`` argument is provided, and ``request.path``
+ begins with //.
"""
# //// is needed to create a request with a path beginning with //
request = self.factory.get('////absolute-uri')
@@ -873,8 +869,8 @@ class BuildAbsoluteURITestCase(SimpleTestCase):
def test_build_absolute_uri_schema_relative_location(self):
"""
- Ensures that ``request.build_absolute_uri()`` returns the proper value
- when a schema-relative URL ``location`` argument is provided, and
+ ``request.build_absolute_uri()`` returns the proper value when
+ a schema-relative URL ``location`` argument is provided, and
``request.path`` begins with //.
"""
# //// is needed to create a request with a path beginning with //
@@ -886,9 +882,9 @@ class BuildAbsoluteURITestCase(SimpleTestCase):
def test_build_absolute_uri_relative_location(self):
"""
- Ensures that ``request.build_absolute_uri()`` returns the proper value
- when a relative URL ``location`` argument is provided, and
- ``request.path`` begins with //.
+ ``request.build_absolute_uri()`` returns the proper value when
+ a relative URL ``location`` argument is provided, and ``request.path``
+ begins with //.
"""
# //// is needed to create a request with a path beginning with //
request = self.factory.get('////absolute-uri')
diff --git a/tests/resolve_url/tests.py b/tests/resolve_url/tests.py
index ecccfa6c9e..d56e08c97c 100644
--- a/tests/resolve_url/tests.py
+++ b/tests/resolve_url/tests.py
@@ -12,20 +12,18 @@ from .urls import some_view
@override_settings(ROOT_URLCONF='resolve_url.urls')
class ResolveUrlTests(SimpleTestCase):
"""
- Tests for the ``resolve_url`` function.
+ Tests for the resolve_url() function.
"""
def test_url_path(self):
"""
- Tests that passing a URL path to ``resolve_url`` will result in the
- same url.
+ Passing a URL path to resolve_url() results in the same url.
"""
self.assertEqual('/something/', resolve_url('/something/'))
def test_relative_path(self):
"""
- Tests that passing a relative URL path to ``resolve_url`` will result
- in the same url.
+ Passing a relative URL path to resolve_url() results in the same url.
"""
self.assertEqual('../', resolve_url('../'))
self.assertEqual('../relative/', resolve_url('../relative/'))
@@ -34,31 +32,30 @@ class ResolveUrlTests(SimpleTestCase):
def test_full_url(self):
"""
- Tests that passing a full URL to ``resolve_url`` will result in the
- same url.
+ Passing a full URL to resolve_url() results in the same url.
"""
url = 'http://example.com/'
self.assertEqual(url, resolve_url(url))
def test_model(self):
"""
- Tests that passing a model to ``resolve_url`` will result in
- ``get_absolute_url`` being called on that model instance.
+ Passing a model to resolve_url() results in get_absolute_url() being
+ called on that model instance.
"""
m = UnimportantThing(importance=1)
self.assertEqual(m.get_absolute_url(), resolve_url(m))
def test_view_function(self):
"""
- Tests that passing a view function to ``resolve_url`` will result in
- the URL path mapping to that view name.
+ Passing a view function to resolve_url() results in the URL path
+ mapping to that view name.
"""
resolved_url = resolve_url(some_view)
self.assertEqual('/some-url/', resolved_url)
def test_lazy_reverse(self):
"""
- Tests that passing the result of reverse_lazy is resolved to a real URL
+ Passing the result of reverse_lazy is resolved to a real URL
string.
"""
resolved_url = resolve_url(reverse_lazy('some-view'))
@@ -67,22 +64,22 @@ class ResolveUrlTests(SimpleTestCase):
def test_valid_view_name(self):
"""
- Tests that passing a view name to ``resolve_url`` will result in the
- URL path mapping to that view.
+ Passing a view name to resolve_url() results in the URL path mapping
+ to that view.
"""
resolved_url = resolve_url('some-view')
self.assertEqual('/some-url/', resolved_url)
def test_domain(self):
"""
- Tests that passing a domain to ``resolve_url`` returns the same domain.
+ Passing a domain to resolve_url() returns the same domain.
"""
self.assertEqual(resolve_url('example.com'), 'example.com')
def test_non_view_callable_raises_no_reverse_match(self):
"""
- Tests that passing a non-view callable into ``resolve_url`` raises a
- ``NoReverseMatch`` exception.
+ Passing a non-view callable into resolve_url() raises a
+ NoReverseMatch exception.
"""
with self.assertRaises(NoReverseMatch):
resolve_url(lambda: 'asdf')
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index 567a1f86da..8f5cab808b 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -37,7 +37,7 @@ from .models import (
class SchemaTests(TransactionTestCase):
"""
- Tests that the schema-alteration code works correctly.
+ Tests for the schema-alteration code.
Be aware that these tests are more liable than most to false results,
as sometimes the code to check if a test has worked is almost as complex
@@ -179,24 +179,24 @@ class SchemaTests(TransactionTestCase):
# Create the table
with connection.schema_editor() as editor:
editor.create_model(Author)
- # Check that it's there
+ # The table is there
list(Author.objects.all())
# Clean up that table
with connection.schema_editor() as editor:
editor.delete_model(Author)
- # Check that it's gone
+ # The table is gone
with self.assertRaises(DatabaseError):
list(Author.objects.all())
@skipUnlessDBFeature('supports_foreign_keys')
def test_fk(self):
- "Tests that creating tables out of FK order, then repointing, works"
+ "Creating tables out of FK order, then repointing, works"
# Create the table
with connection.schema_editor() as editor:
editor.create_model(Book)
editor.create_model(Author)
editor.create_model(Tag)
- # Check that initial tables are there
+ # Initial tables are there
list(Author.objects.all())
list(Book.objects.all())
# Make sure the FK constraint is present
@@ -223,7 +223,7 @@ class SchemaTests(TransactionTestCase):
@skipUnlessDBFeature('supports_foreign_keys')
def test_fk_to_proxy(self):
- "Tests that creating a FK to a proxy model creates database constraints."
+ "Creating a FK to a proxy model creates database constraints."
class AuthorProxy(Author):
class Meta:
app_label = 'schema'
@@ -253,17 +253,17 @@ class SchemaTests(TransactionTestCase):
@skipUnlessDBFeature('supports_foreign_keys')
def test_fk_db_constraint(self):
- "Tests that the db_constraint parameter is respected"
+ "The db_constraint parameter is respected"
# Create the table
with connection.schema_editor() as editor:
editor.create_model(Tag)
editor.create_model(Author)
editor.create_model(BookWeak)
- # Check that initial tables are there
+ # Initial tables are there
list(Author.objects.all())
list(Tag.objects.all())
list(BookWeak.objects.all())
- # Check that BookWeak doesn't have an FK constraint
+ # BookWeak doesn't have an FK constraint
constraints = self.get_constraints(BookWeak._meta.db_table)
for name, details in constraints.items():
if details['columns'] == ["author_id"] and details['foreign_key']:
@@ -273,7 +273,7 @@ class SchemaTests(TransactionTestCase):
new_field.set_attributes_from_name("tag")
with connection.schema_editor() as editor:
editor.add_field(Author, new_field)
- # Make sure no FK constraint is present
+ # No FK constraint is present
constraints = self.get_constraints(Author._meta.db_table)
for name, details in constraints.items():
if details['columns'] == ["tag_id"] and details['foreign_key']:
@@ -283,7 +283,7 @@ class SchemaTests(TransactionTestCase):
new_field2.set_attributes_from_name("tag")
with connection.schema_editor() as editor:
editor.alter_field(Author, new_field, new_field2, strict=True)
- # Make sure the new FK constraint is present
+ # The new FK constraint is present
constraints = self.get_constraints(Author._meta.db_table)
for name, details in constraints.items():
if details['columns'] == ["tag_id"] and details['foreign_key']:
@@ -296,7 +296,7 @@ class SchemaTests(TransactionTestCase):
new_field2.set_attributes_from_name("tag")
with connection.schema_editor() as editor:
editor.alter_field(Author, new_field2, new_field, strict=True)
- # Make sure no FK constraint is present
+ # No FK constraint is present
constraints = self.get_constraints(Author._meta.db_table)
for name, details in constraints.items():
if details['columns'] == ["tag_id"] and details['foreign_key']:
@@ -316,7 +316,7 @@ class SchemaTests(TransactionTestCase):
with connection.schema_editor() as editor:
editor.create_model(Tag)
editor.create_model(LocalAuthorWithM2M)
- # Check that initial tables are there
+ # Initial tables are there
list(LocalAuthorWithM2M.objects.all())
list(Tag.objects.all())
# Make a db_constraint=False FK
@@ -325,7 +325,7 @@ class SchemaTests(TransactionTestCase):
# Add the field
with connection.schema_editor() as editor:
editor.add_field(LocalAuthorWithM2M, new_field)
- # Make sure no FK constraint is present
+ # No FK constraint is present
constraints = self.get_constraints(new_field.remote_field.through._meta.db_table)
for name, details in constraints.items():
if details['columns'] == ["tag_id"] and details['foreign_key']:
@@ -1779,12 +1779,12 @@ class SchemaTests(TransactionTestCase):
except OperationalError as e:
self.fail("Errors when applying initial migration for a model "
"with a table named after an SQL reserved word: %s" % e)
- # Check that it's there
+ # The table is there
list(Thing.objects.all())
# Clean up that table
with connection.schema_editor() as editor:
editor.delete_model(Thing)
- # Check that it's gone
+ # The table is gone
with self.assertRaises(DatabaseError):
list(Thing.objects.all())
diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py
index 4c30ff7179..9e5ee598b0 100644
--- a/tests/select_for_update/tests.py
+++ b/tests/select_for_update/tests.py
@@ -63,7 +63,7 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature('has_select_for_update')
def test_for_update_sql_generated(self):
"""
- Test that the backend's FOR UPDATE variant appears in
+ The backend's FOR UPDATE variant appears in
generated SQL when select_for_update is invoked.
"""
with transaction.atomic(), CaptureQueriesContext(connection) as ctx:
@@ -73,7 +73,7 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature('has_select_for_update_nowait')
def test_for_update_sql_generated_nowait(self):
"""
- Test that the backend's FOR UPDATE NOWAIT variant appears in
+ The backend's FOR UPDATE NOWAIT variant appears in
generated SQL when select_for_update is invoked.
"""
with transaction.atomic(), CaptureQueriesContext(connection) as ctx:
@@ -83,7 +83,7 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature('has_select_for_update_skip_locked')
def test_for_update_sql_generated_skip_locked(self):
"""
- Test that the backend's FOR UPDATE SKIP LOCKED variant appears in
+ The backend's FOR UPDATE SKIP LOCKED variant appears in
generated SQL when select_for_update is invoked.
"""
with transaction.atomic(), CaptureQueriesContext(connection) as ctx:
@@ -163,7 +163,7 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature('has_select_for_update')
def test_for_update_requires_transaction(self):
"""
- Test that a TransactionManagementError is raised
+ A TransactionManagementError is raised
when a select_for_update query is executed outside of a transaction.
"""
with self.assertRaises(transaction.TransactionManagementError):
@@ -172,7 +172,7 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature('has_select_for_update')
def test_for_update_requires_transaction_only_in_execution(self):
"""
- Test that no TransactionManagementError is raised
+ No TransactionManagementError is raised
when select_for_update is invoked outside of a transaction -
only when the query is executed.
"""
@@ -207,9 +207,8 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature('supports_transactions')
def test_block(self):
"""
- Check that a thread running a select_for_update that
- accesses rows being touched by a similar operation
- on another connection blocks correctly.
+ A thread running a select_for_update that accesses rows being touched
+ by a similar operation on another connection blocks correctly.
"""
# First, let's start the transaction in our thread.
self.start_blocking_transaction()
@@ -255,8 +254,8 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature('has_select_for_update')
def test_raw_lock_not_available(self):
"""
- Check that running a raw query which can't obtain a FOR UPDATE lock
- raises the correct exception
+ Running a raw query which can't obtain a FOR UPDATE lock raises
+ the correct exception
"""
self.start_blocking_transaction()
diff --git a/tests/serializers/models/data.py b/tests/serializers/models/data.py
index c95fa77ad9..0deadc3795 100644
--- a/tests/serializers/models/data.py
+++ b/tests/serializers/models/data.py
@@ -275,8 +275,8 @@ class ModifyingSaveData(models.Model):
def save(self, *args, **kwargs):
"""
A save method that modifies the data in the object.
- Verifies that a user-defined save() method isn't called when objects
- are deserialized (#4459).
+ A user-defined save() method isn't called when objects are deserialized
+ (#4459).
"""
self.data = 666
super(ModifyingSaveData, self).save(*args, **kwargs)
diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py
index 4098d050b4..7d0726ce70 100644
--- a/tests/serializers/tests.py
+++ b/tests/serializers/tests.py
@@ -123,12 +123,12 @@ class SerializersTestBase(object):
self.a2.categories.set([music, op_ed])
def test_serialize(self):
- """Tests that basic serialization works."""
+ """Basic serialization works."""
serial_str = serializers.serialize(self.serializer_name, Article.objects.all())
self.assertTrue(self._validate_output(serial_str))
def test_serializer_roundtrip(self):
- """Tests that serialized content can be deserialized."""
+ """Serialized content can be deserialized."""
serial_str = serializers.serialize(self.serializer_name, Article.objects.all())
models = list(serializers.deserialize(self.serializer_name, serial_str))
self.assertEqual(len(models), 2)
@@ -144,7 +144,7 @@ class SerializersTestBase(object):
# Serialize normally for a comparison
string_data = serializers.serialize(self.serializer_name, [obj], indent=2)
- # Check that the two are the same
+ # The two are the same
if isinstance(stream, StringIO):
self.assertEqual(string_data, stream.getvalue())
else:
@@ -160,15 +160,14 @@ class SerializersTestBase(object):
)
result = next(serializers.deserialize(self.serializer_name, serialized_data))
- # Check that the deserialized object contains data in only the serialized fields.
+ # The deserialized object contains data in only the serialized fields.
self.assertEqual(result.object.field1, 'first')
self.assertEqual(result.object.field2, '')
self.assertEqual(result.object.field3, 'third')
def test_altering_serialized_output(self):
"""
- Tests the ability to create new objects by
- modifying serialized content.
+ The ability to create new objects by modifying serialized content.
"""
old_headline = "Poker has no place on ESPN"
new_headline = "Poker has no place on television"
@@ -189,9 +188,9 @@ class SerializersTestBase(object):
def test_one_to_one_as_pk(self):
"""
- Tests that if you use your own primary key field
- (such as a OneToOneField), it doesn't appear in the
- serialized field list - it replaces the pk identifier.
+ If you use your own primary key field (such as a OneToOneField), it
+ doesn't appear in the serialized field list - it replaces the pk
+ identifier.
"""
AuthorProfile.objects.create(author=self.joe, date_of_birth=datetime(1970, 1, 1))
serial_str = serializers.serialize(self.serializer_name, AuthorProfile.objects.all())
@@ -201,7 +200,7 @@ class SerializersTestBase(object):
self.assertEqual(obj.object.pk, self._comparison_value(self.joe.pk))
def test_serialize_field_subset(self):
- """Tests that output can be restricted to a subset of fields"""
+ """Output can be restricted to a subset of fields"""
valid_fields = ('headline', 'pub_date')
invalid_fields = ("author", "categories")
serial_str = serializers.serialize(self.serializer_name, Article.objects.all(), fields=valid_fields)
@@ -212,7 +211,7 @@ class SerializersTestBase(object):
self.assertTrue(self._get_field_values(serial_str, field_name))
def test_serialize_unicode(self):
- """Tests that unicode makes the roundtrip intact"""
+ """Unicode makes the roundtrip intact"""
actor_name = "Za\u017c\u00f3\u0142\u0107"
movie_title = 'G\u0119\u015bl\u0105 ja\u017a\u0144'
ac = Actor(name=actor_name)
@@ -253,7 +252,7 @@ class SerializersTestBase(object):
def test_serialize_with_null_pk(self):
"""
- Tests that serialized data with no primary key results
+ Serialized data with no primary key results
in a model instance with no id
"""
category = Category(name="Reference")
@@ -265,7 +264,7 @@ class SerializersTestBase(object):
self.assertIsNone(cat_obj.id)
def test_float_serialization(self):
- """Tests that float values serialize and deserialize intact"""
+ """Float values serialize and deserialize intact"""
sc = Score(score=3.4)
sc.save()
serial_str = serializers.serialize(self.serializer_name, [sc])
@@ -282,7 +281,7 @@ class SerializersTestBase(object):
self.assertEqual(deserial_objs[0].object.__class__, Author)
def test_custom_field_serialization(self):
- """Tests that custom fields serialize and deserialize intact"""
+ """Custom fields serialize and deserialize intact"""
team_str = "Spartak Moskva"
player = Player()
player.name = "Soslan Djanaev"
@@ -298,7 +297,7 @@ class SerializersTestBase(object):
self.assertEqual(deserial_objs[0].object.team.to_string(), player.team.to_string())
def test_pre_1000ad_date(self):
- """Tests that year values before 1000AD are properly formatted"""
+ """Year values before 1000AD are properly formatted"""
# Regression for #12524 -- dates before 1000AD get prefixed
# 0's on the year
a = Article.objects.create(
@@ -312,8 +311,7 @@ class SerializersTestBase(object):
def test_pkless_serialized_strings(self):
"""
- Tests that serialized strings without PKs
- can be turned into models
+ Serialized strings without PKs can be turned into models
"""
deserial_objs = list(serializers.deserialize(self.serializer_name, self.pkless_str))
for obj in deserial_objs:
@@ -333,7 +331,7 @@ class SerializersTestBase(object):
})
def test_deserialize_force_insert(self):
- """Tests that deserialized content can be saved with force_insert as a parameter."""
+ """Deserialized content can be saved with force_insert as a parameter."""
serial_str = serializers.serialize(self.serializer_name, [self.a1])
deserial_obj = list(serializers.deserialize(self.serializer_name, serial_str))[0]
with mock.patch('django.db.models.Model') as mock_model:
@@ -383,7 +381,7 @@ class SerializersTransactionTestBase(object):
@skipUnlessDBFeature('supports_forward_references')
def test_forward_refs(self):
"""
- Tests that objects ids can be referenced before they are
+ Objects ids can be referenced before they are
defined in the serialization data.
"""
# The deserialization process needs to run in a transaction in order
diff --git a/tests/servers/tests.py b/tests/servers/tests.py
index 3d959b4b23..03e05d0957 100644
--- a/tests/servers/tests.py
+++ b/tests/servers/tests.py
@@ -57,33 +57,21 @@ class LiveServerAddress(LiveServerBase):
class LiveServerViews(LiveServerBase):
def test_404(self):
- """
- Ensure that the LiveServerTestCase serves 404s.
- Refs #2879.
- """
with self.assertRaises(HTTPError) as err:
self.urlopen('/')
self.assertEqual(err.exception.code, 404, 'Expected 404 response')
def test_view(self):
- """
- Ensure that the LiveServerTestCase serves views.
- Refs #2879.
- """
with contextlib.closing(self.urlopen('/example_view/')) as f:
self.assertEqual(f.read(), b'example view')
def test_static_files(self):
- """
- Ensure that the LiveServerTestCase serves static files.
- Refs #2879.
- """
with contextlib.closing(self.urlopen('/static/example_static_file.txt')) as f:
self.assertEqual(f.read().rstrip(b'\r\n'), b'example static file')
def test_no_collectstatic_emulation(self):
"""
- Test that LiveServerTestCase reports a 404 status code when HTTP client
+ LiveServerTestCase reports a 404 status code when HTTP client
tries to access a static file that isn't explicitly put under
STATIC_ROOT.
"""
@@ -92,10 +80,6 @@ class LiveServerViews(LiveServerBase):
self.assertEqual(err.exception.code, 404, 'Expected 404 response')
def test_media_files(self):
- """
- Ensure that the LiveServerTestCase serves media files.
- Refs #2879.
- """
with contextlib.closing(self.urlopen('/media/example_media_file.txt')) as f:
self.assertEqual(f.read().rstrip(b'\r\n'), b'example media file')
@@ -108,17 +92,14 @@ class LiveServerDatabase(LiveServerBase):
def test_fixtures_loaded(self):
"""
- Ensure that fixtures are properly loaded and visible to the
- live server thread.
- Refs #2879.
+ Fixtures are properly loaded and visible to the live server thread.
"""
with contextlib.closing(self.urlopen('/model_view/')) as f:
self.assertEqual(f.read().splitlines(), [b'jane', b'robert'])
def test_database_writes(self):
"""
- Ensure that data written to the database by a view can be read.
- Refs #2879.
+ Data written to the database by a view can be read.
"""
self.urlopen('/create_model_instance/')
self.assertQuerysetEqual(
diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py
index d5690e1668..ae57f1d919 100644
--- a/tests/sessions_tests/tests.py
+++ b/tests/sessions_tests/tests.py
@@ -695,7 +695,7 @@ class SessionMiddlewareTests(TestCase):
# Handle the response through the middleware
response = middleware.process_response(request, response)
- # Check that the value wasn't saved above.
+ # The value wasn't saved above.
self.assertNotIn('hello', request.session.load())
def test_session_update_error_redirect(self):
@@ -733,7 +733,7 @@ class SessionMiddlewareTests(TestCase):
# Handle the response through the middleware
response = middleware.process_response(request, response)
- # Check that the cookie was deleted, not recreated.
+ # The cookie was deleted, not recreated.
# A deleted cookie header looks like:
# Set-Cookie: sessionid=; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
self.assertEqual(
@@ -761,7 +761,7 @@ class SessionMiddlewareTests(TestCase):
# Handle the response through the middleware
response = middleware.process_response(request, response)
- # Check that the cookie was deleted, not recreated.
+ # The cookie was deleted, not recreated.
# A deleted cookie header with a custom domain and path looks like:
# Set-Cookie: sessionid=; Domain=.example.local;
# expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0;
diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py
index 97d734ed68..14a3b793ca 100644
--- a/tests/settings_tests/tests.py
+++ b/tests/settings_tests/tests.py
@@ -115,7 +115,7 @@ class ClassDecoratedTestCase(ClassDecoratedTestCaseSuper):
self.assertEqual(settings.TEST, 'override')
def test_setupclass_override(self):
- """Test that settings are overridden within setUpClass -- refs #21281"""
+ """Settings are overridden within setUpClass (#21281)."""
self.assertEqual(self.foo, 'override')
@override_settings(TEST='override2')
@@ -260,7 +260,7 @@ class SettingsTests(SimpleTestCase):
def test_override_settings_nested(self):
"""
- Test that override_settings uses the actual _wrapped attribute at
+ override_settings uses the actual _wrapped attribute at
runtime, not when it was instantiated.
"""
diff --git a/tests/signals/tests.py b/tests/signals/tests.py
index 3907bf93ed..7fd04df36a 100644
--- a/tests/signals/tests.py
+++ b/tests/signals/tests.py
@@ -23,7 +23,7 @@ class BaseSignalTest(TestCase):
)
def tearDown(self):
- # Check that all our signals got disconnected properly.
+ # All our signals got disconnected properly.
post_signals = (
len(signals.pre_save.receivers),
len(signals.post_save.receivers),
@@ -246,7 +246,7 @@ class SignalTests(BaseSignalTest):
def test_disconnect_in_dispatch(self):
"""
- Test that signals that disconnect when being called don't mess future
+ Signals that disconnect when being called don't mess future
dispatching.
"""
diff --git a/tests/sitemaps_tests/test_http.py b/tests/sitemaps_tests/test_http.py
index 33599e9ed9..8367b495d8 100644
--- a/tests/sitemaps_tests/test_http.py
+++ b/tests/sitemaps_tests/test_http.py
@@ -81,7 +81,7 @@ class HTTPSitemapTests(SitemapTestsBase):
self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
def test_sitemap_last_modified(self):
- "Tests that Last-Modified header is set correctly"
+ "Last-Modified header is set correctly"
response = self.client.get('/lastmod/sitemap.xml')
self.assertEqual(response['Last-Modified'], 'Wed, 13 Mar 2013 10:00:00 GMT')
@@ -101,12 +101,12 @@ class HTTPSitemapTests(SitemapTestsBase):
self.assertEqual(response['Last-Modified'], 'Wed, 13 Mar 2013 15:00:00 GMT')
def test_sitemap_last_modified_missing(self):
- "Tests that Last-Modified header is missing when sitemap has no lastmod"
+ "Last-Modified header is missing when sitemap has no lastmod"
response = self.client.get('/generic/sitemap.xml')
self.assertFalse(response.has_header('Last-Modified'))
def test_sitemap_last_modified_mixed(self):
- "Tests that Last-Modified header is omitted when lastmod not on all items"
+ "Last-Modified header is omitted when lastmod not on all items"
response = self.client.get('/lastmod-mixed/sitemap.xml')
self.assertFalse(response.has_header('Last-Modified'))
@@ -149,8 +149,7 @@ class HTTPSitemapTests(SitemapTestsBase):
activate('fr')
self.assertEqual('0,3', localize(0.3))
- # Retrieve the sitemap. Check that priorities
- # haven't been rendered in localized format
+ # Priorities haven't been rendered in localized format.
response = self.client.get('/simple/sitemap.xml')
self.assertContains(response, '0.5')
self.assertContains(response, '%s' % date.today())
@@ -158,8 +157,8 @@ class HTTPSitemapTests(SitemapTestsBase):
@modify_settings(INSTALLED_APPS={'remove': 'django.contrib.sites'})
def test_requestsite_sitemap(self):
- # Make sure hitting the flatpages sitemap without the sites framework
- # installed doesn't raise an exception.
+ # Hitting the flatpages sitemap without the sites framework installed
+ # doesn't raise an exception.
response = self.client.get('/simple/sitemap.xml')
expected_content = """
@@ -203,7 +202,7 @@ class HTTPSitemapTests(SitemapTestsBase):
def test_cached_sitemap_index(self):
"""
- Check that a cached sitemap index can be rendered (#2713).
+ A cached sitemap index can be rendered (#2713).
"""
response = self.client.get('/cached/index.xml')
expected_content = """
diff --git a/tests/sites_tests/tests.py b/tests/sites_tests/tests.py
index 8c540f82ea..64fe2215d4 100644
--- a/tests/sites_tests/tests.py
+++ b/tests/sites_tests/tests.py
@@ -60,7 +60,7 @@ class SitesFrameworkTests(TestCase):
@override_settings(ALLOWED_HOSTS=['example.com'])
def test_get_current_site(self):
- # Test that the correct Site object is returned
+ # The correct Site object is returned
request = HttpRequest()
request.META = {
"SERVER_NAME": "example.com",
@@ -70,7 +70,7 @@ class SitesFrameworkTests(TestCase):
self.assertIsInstance(site, Site)
self.assertEqual(site.id, settings.SITE_ID)
- # Test that an exception is raised if the sites framework is installed
+ # An exception is raised if the sites framework is installed
# but there is no matching Site
site.delete()
with self.assertRaises(ObjectDoesNotExist):
@@ -265,9 +265,9 @@ class CreateDefaultSiteTests(TestCase):
#17415 - Another site can be created right after the default one.
On some backends the sequence needs to be reset after saving with an
- explicit ID. Test that there isn't a sequence collisions by saving
- another site. This test is only meaningful with databases that use
- sequences for automatic primary keys such as PostgreSQL and Oracle.
+ explicit ID. There shouldn't be a sequence collisions by saving another
+ site. This test is only meaningful with databases that use sequences
+ for automatic primary keys such as PostgreSQL and Oracle.
"""
create_default_site(self.app_config, verbosity=0)
Site(domain='example2.com', name='example2.com').save()
@@ -309,7 +309,7 @@ class CreateDefaultSiteTests(TestCase):
class MiddlewareTest(TestCase):
def test_old_style_request(self):
- """ Makes sure that the request has correct `site` attribute. """
+ """The request has correct `site` attribute."""
middleware = CurrentSiteMiddleware()
request = HttpRequest()
middleware.process_request(request)
diff --git a/tests/staticfiles_tests/test_liveserver.py b/tests/staticfiles_tests/test_liveserver.py
index 1bbadb337b..1714ae8b1b 100644
--- a/tests/staticfiles_tests/test_liveserver.py
+++ b/tests/staticfiles_tests/test_liveserver.py
@@ -83,7 +83,7 @@ class StaticLiveServerView(LiveServerBase):
@modify_settings(INSTALLED_APPS={'append': 'staticfiles_tests.apps.test'})
def test_collectstatic_emulation(self):
"""
- Test that StaticLiveServerTestCase use of staticfiles' serve() allows it
+ StaticLiveServerTestCase use of staticfiles' serve() allows it
to discover app's static assets without having to collectstatic first.
"""
with contextlib.closing(self.urlopen('/static/test/file.txt')) as f:
diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py
index 6ac9794b34..d4d5064b74 100644
--- a/tests/staticfiles_tests/test_management.py
+++ b/tests/staticfiles_tests/test_management.py
@@ -45,7 +45,7 @@ class TestFindStatic(TestDefaults, CollectionTestCase):
def test_all_files(self):
"""
- Test that findstatic returns all candidate files if run without --first and -v1.
+ findstatic returns all candidate files if run without --first and -v1.
"""
result = call_command('findstatic', 'test/file.txt', verbosity=1, stdout=six.StringIO())
lines = [l.strip() for l in result.split('\n')]
@@ -55,7 +55,7 @@ class TestFindStatic(TestDefaults, CollectionTestCase):
def test_all_files_less_verbose(self):
"""
- Test that findstatic returns all candidate files if run without --first and -v0.
+ findstatic returns all candidate files if run without --first and -v0.
"""
result = call_command('findstatic', 'test/file.txt', verbosity=0, stdout=six.StringIO())
lines = [l.strip() for l in result.split('\n')]
@@ -65,7 +65,7 @@ class TestFindStatic(TestDefaults, CollectionTestCase):
def test_all_files_more_verbose(self):
"""
- Test that findstatic returns all candidate files if run without --first and -v2.
+ findstatic returns all candidate files if run without --first and -v2.
Also, test that findstatic returns the searched locations with -v2.
"""
result = call_command('findstatic', 'test/file.txt', verbosity=2, stdout=six.StringIO())
@@ -140,7 +140,7 @@ class TestCollection(TestDefaults, CollectionTestCase):
"""
def test_ignore(self):
"""
- Test that -i patterns are ignored.
+ -i patterns are ignored.
"""
self.assertFileNotFound('test/test.ignoreme')
diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py
index 5298a287fd..c0fed0e4ae 100644
--- a/tests/staticfiles_tests/test_storage.py
+++ b/tests/staticfiles_tests/test_storage.py
@@ -148,7 +148,7 @@ class TestHashedFiles(object):
def test_post_processing(self):
"""
- Test that post_processing behaves correctly.
+ post_processing behaves correctly.
Files that are alterable should always be post-processed; files that
aren't should be skipped.
@@ -188,8 +188,7 @@ class TestHashedFiles(object):
)
def test_post_processing_failure(self):
"""
- Test that post_processing indicates the origin of the error when it
- fails. Regression test for #18986.
+ post_processing indicates the origin of the error when it fails.
"""
finders.get_finder.cache_clear()
err = six.StringIO()
diff --git a/tests/string_lookup/tests.py b/tests/string_lookup/tests.py
index 0bd60a053a..805833a8e4 100644
--- a/tests/string_lookup/tests.py
+++ b/tests/string_lookup/tests.py
@@ -12,8 +12,8 @@ class StringLookupTests(TestCase):
"""
Regression test for #1661 and #1662
- Check that string form referencing of
- models works, both as pre and post reference, on all RelatedField types.
+ String form referencing of models works, both as pre and post
+ reference, on all RelatedField types.
"""
f1 = Foo(name="Foo1")
@@ -79,5 +79,5 @@ class StringLookupTests(TestCase):
a = Article(name='IP test', text='The body', submitted_from='192.0.2.100')
a.save()
self.assertSequenceEqual(Article.objects.filter(submitted_from__contains='192.0.2'), [a])
- # Test that the searches do not match the subnet mask (/32 in this case)
+ # The searches do not match the subnet mask (/32 in this case)
self.assertEqual(Article.objects.filter(submitted_from__contains='32').count(), 0)
diff --git a/tests/swappable_models/tests.py b/tests/swappable_models/tests.py
index 9fd6a15942..a9a7751888 100644
--- a/tests/swappable_models/tests.py
+++ b/tests/swappable_models/tests.py
@@ -29,7 +29,7 @@ class SwappableModelTests(TestCase):
new_io = StringIO()
management.call_command('migrate', interactive=False, stdout=new_io)
- # Check that content types and permissions exist for the swapped model,
+ # Content types and permissions exist for the swapped model,
# but not for the swappable model.
apps_models = [(p.content_type.app_label, p.content_type.model)
for p in Permission.objects.all()]
@@ -43,6 +43,6 @@ class SwappableModelTests(TestCase):
@override_settings(TEST_ARTICLE_MODEL='swappable_models.article')
def test_case_insensitive(self):
- "Model names are case insensitive. Check that model swapping honors this."
+ "Model names are case insensitive. Model swapping honors this."
Article.objects.all()
self.assertIsNone(Article._meta.swapped)
diff --git a/tests/syndication_tests/tests.py b/tests/syndication_tests/tests.py
index 60285efea7..f8948ac21d 100644
--- a/tests/syndication_tests/tests.py
+++ b/tests/syndication_tests/tests.py
@@ -283,7 +283,7 @@ class SyndicationFeedTest(FeedTestCase):
def test_atom_feed_published_and_updated_elements(self):
"""
- Test that the published and updated elements are not
+ The published and updated elements are not
the same and now adhere to RFC 4287.
"""
response = self.client.get('/syndication/atom/')
@@ -315,7 +315,7 @@ class SyndicationFeedTest(FeedTestCase):
def test_latest_post_date(self):
"""
- Test that both the published and updated dates are
+ Both the published and updated dates are
considered when determining the latest post date.
"""
# this feed has a `published` element with the latest date
@@ -370,7 +370,7 @@ class SyndicationFeedTest(FeedTestCase):
def test_title_escaping(self):
"""
- Tests that titles are escaped correctly in RSS feeds.
+ Titles are escaped correctly in RSS feeds.
"""
response = self.client.get('/syndication/rss2/')
doc = minidom.parseString(response.content)
@@ -382,7 +382,7 @@ class SyndicationFeedTest(FeedTestCase):
def test_naive_datetime_conversion(self):
"""
- Test that datetimes are correctly converted to the local time zone.
+ Datetimes are correctly converted to the local time zone.
"""
# Naive date times passed in get converted to the local time zone, so
# check the received zone offset against the local offset.
@@ -397,7 +397,7 @@ class SyndicationFeedTest(FeedTestCase):
def test_aware_datetime_conversion(self):
"""
- Test that datetimes with timezones don't get trodden on.
+ Datetimes with timezones don't get trodden on.
"""
response = self.client.get('/syndication/aware-dates/')
doc = minidom.parseString(response.content)
@@ -425,7 +425,7 @@ class SyndicationFeedTest(FeedTestCase):
def test_feed_url(self):
"""
- Test that the feed_url can be overridden.
+ The feed_url can be overridden.
"""
response = self.client.get('/syndication/feedurl/')
doc = minidom.parseString(response.content)
@@ -454,16 +454,15 @@ class SyndicationFeedTest(FeedTestCase):
def test_item_link_error(self):
"""
- Test that an ImproperlyConfigured is raised if no link could be found
- for the item(s).
+ An ImproperlyConfigured is raised if no link could be found for the
+ item(s).
"""
with self.assertRaises(ImproperlyConfigured):
self.client.get('/syndication/articles/')
def test_template_feed(self):
"""
- Test that the item title and description can be overridden with
- templates.
+ The item title and description can be overridden with templates.
"""
response = self.client.get('/syndication/template/')
doc = minidom.parseString(response.content)
@@ -479,7 +478,7 @@ class SyndicationFeedTest(FeedTestCase):
def test_template_context_feed(self):
"""
- Test that custom context data can be passed to templates for title
+ Custom context data can be passed to templates for title
and description.
"""
response = self.client.get('/syndication/template_context/')
@@ -495,7 +494,7 @@ class SyndicationFeedTest(FeedTestCase):
def test_add_domain(self):
"""
- Test add_domain() prefixes domains onto the correct URLs.
+ add_domain() prefixes domains onto the correct URLs.
"""
self.assertEqual(
views.add_domain('example.com', '/foo/?arg=value'),
diff --git a/tests/template_backends/test_django.py b/tests/template_backends/test_django.py
index a474b0765f..41eaff0c6d 100644
--- a/tests/template_backends/test_django.py
+++ b/tests/template_backends/test_django.py
@@ -27,11 +27,11 @@ class DjangoTemplatesTests(TemplateStringsTests):
template = engine.from_string('{{ processors }}')
request = RequestFactory().get('/')
- # Check that context processors run
+ # Context processors run
content = template.render({}, request)
self.assertEqual(content, 'yes')
- # Check that context overrides context processors
+ # Context overrides context processors
content = template.render({'processors': 'no'}, request)
self.assertEqual(content, 'no')
diff --git a/tests/template_tests/filter_tests/test_floatformat.py b/tests/template_tests/filter_tests/test_floatformat.py
index 099ec4d174..d2c39d3d48 100644
--- a/tests/template_tests/filter_tests/test_floatformat.py
+++ b/tests/template_tests/filter_tests/test_floatformat.py
@@ -56,14 +56,10 @@ class FunctionTests(SimpleTestCase):
self.assertEqual(floatformat(None), '')
def test_zero_values(self):
- """
- Check that we're not converting to scientific notation.
- """
self.assertEqual(floatformat(0, 6), '0.000000')
self.assertEqual(floatformat(0, 7), '0.0000000')
self.assertEqual(floatformat(0, 10), '0.0000000000')
- self.assertEqual(floatformat(0.000000000000000000015, 20),
- '0.00000000000000000002')
+ self.assertEqual(floatformat(0.000000000000000000015, 20), '0.00000000000000000002')
def test_infinity(self):
pos_inf = float(1e30000)
diff --git a/tests/template_tests/filter_tests/test_join.py b/tests/template_tests/filter_tests/test_join.py
index 12d2f7257e..2d2a9cf78e 100644
--- a/tests/template_tests/filter_tests/test_join.py
+++ b/tests/template_tests/filter_tests/test_join.py
@@ -27,8 +27,7 @@ class JoinTests(SimpleTestCase):
output = self.engine.render_to_string('join04', {'a': ['alpha', 'beta & me']})
self.assertEqual(output, 'alpha & beta & me')
- # #11377 Test that joining with unsafe joiners doesn't result in
- # unsafe strings
+ # Joining with unsafe joiners doesn't result in unsafe strings.
@setup({'join05': '{{ a|join:var }}'})
def test_join05(self):
output = self.engine.render_to_string('join05', {'a': ['alpha', 'beta & me'], 'var': ' & '})
diff --git a/tests/template_tests/filter_tests/test_timesince.py b/tests/template_tests/filter_tests/test_timesince.py
index 0572b5bd1c..0cb975a90e 100644
--- a/tests/template_tests/filter_tests/test_timesince.py
+++ b/tests/template_tests/filter_tests/test_timesince.py
@@ -54,7 +54,7 @@ class TimesinceTests(TimezoneTestCase):
)
self.assertEqual(output, '1\xa0minute')
- # Check that timezone is respected
+ # Timezone is respected
@setup({'timesince06': '{{ a|timesince:b }}'})
def test_timesince06(self):
output = self.engine.render_to_string('timesince06', {'a': self.now_tz - timedelta(hours=8), 'b': self.now_tz})
@@ -83,7 +83,7 @@ class TimesinceTests(TimezoneTestCase):
output = self.engine.render_to_string('timesince10', {'now': self.now, 'later': self.now + timedelta(days=7)})
self.assertEqual(output, '0\xa0minutes')
- # Ensures that differing timezones are calculated correctly.
+ # Differing timezones are calculated correctly.
@setup({'timesince11': '{{ a|timesince }}'})
def test_timesince11(self):
output = self.engine.render_to_string('timesince11', {'a': self.now})
diff --git a/tests/template_tests/filter_tests/test_timeuntil.py b/tests/template_tests/filter_tests/test_timeuntil.py
index 2fe633ffa2..1b06a21c93 100644
--- a/tests/template_tests/filter_tests/test_timeuntil.py
+++ b/tests/template_tests/filter_tests/test_timeuntil.py
@@ -70,7 +70,7 @@ class TimeuntilTests(TimezoneTestCase):
output = self.engine.render_to_string('timeuntil09', {'now': self.now, 'later': self.now + timedelta(days=7)})
self.assertEqual(output, '1\xa0week')
- # Ensures that differing timezones are calculated correctly.
+ # Differing timezones are calculated correctly.
@requires_tz_support
@setup({'timeuntil10': '{{ a|timeuntil }}'})
def test_timeuntil10(self):
diff --git a/tests/template_tests/syntax_tests/test_for.py b/tests/template_tests/syntax_tests/test_for.py
index 4af7881e57..2891d16f67 100644
--- a/tests/template_tests/syntax_tests/test_for.py
+++ b/tests/template_tests/syntax_tests/test_for.py
@@ -87,7 +87,7 @@ class ForTagTests(SimpleTestCase):
@setup({'for-tag-unpack09': '{% for val in items %}{{ val.0 }}:{{ val.1 }}/{% endfor %}'})
def test_for_tag_unpack09(self):
"""
- Ensure that a single loopvar doesn't truncate the list in val.
+ A single loopvar doesn't truncate the list in val.
"""
output = self.engine.render_to_string('for-tag-unpack09', {'items': (('one', 1), ('two', 2))})
self.assertEqual(output, 'one:1/two:2/')
diff --git a/tests/template_tests/syntax_tests/test_include.py b/tests/template_tests/syntax_tests/test_include.py
index ebf3e8e7ab..ca7ee6f5b0 100644
--- a/tests/template_tests/syntax_tests/test_include.py
+++ b/tests/template_tests/syntax_tests/test_include.py
@@ -226,7 +226,7 @@ class IncludeTests(SimpleTestCase):
def test_include_missing_template(self):
"""
- Tests that the correct template is identified as not existing
+ The correct template is identified as not existing
when {% include %} specifies a template that does not exist.
"""
engine = Engine(app_dirs=True, debug=True)
@@ -237,7 +237,7 @@ class IncludeTests(SimpleTestCase):
def test_extends_include_missing_baseloader(self):
"""
- #12787 -- Tests that the correct template is identified as not existing
+ #12787 -- The correct template is identified as not existing
when {% extends %} specifies a template that does exist, but that
template has an {% include %} of something that does not exist.
"""
diff --git a/tests/template_tests/test_context.py b/tests/template_tests/test_context.py
index c061610a19..79f7b06794 100644
--- a/tests/template_tests/test_context.py
+++ b/tests/template_tests/test_context.py
@@ -116,7 +116,7 @@ class ContextTests(SimpleTestCase):
def test_render_context(self):
test_context = RenderContext({'fruit': 'papaya'})
- # Test that push() limits access to the topmost dict
+ # push() limits access to the topmost dict
test_context.push()
test_context['vegetable'] = 'artichoke'
diff --git a/tests/template_tests/test_custom.py b/tests/template_tests/test_custom.py
index 12331afce8..e1df10c760 100644
--- a/tests/template_tests/test_custom.py
+++ b/tests/template_tests/test_custom.py
@@ -127,7 +127,8 @@ class SimpleTagTests(TagTestCase):
self.assertEqual(t.render(c), "Hello Jack & Jill!")
def test_simple_tag_registration(self):
- # Test that the decorators preserve the decorated function's docstring, name and attributes.
+ # The decorators preserve the decorated function's docstring, name,
+ # and attributes.
self.verify_tag(custom.no_params, 'no_params')
self.verify_tag(custom.one_param, 'one_param')
self.verify_tag(custom.explicit_no_context, 'explicit_no_context')
@@ -257,7 +258,8 @@ class InclusionTagTests(TagTestCase):
self.assertEqual(t.render(c), entry[1])
def test_inclusion_tag_registration(self):
- # Test that the decorators preserve the decorated function's docstring, name and attributes.
+ # The decorators preserve the decorated function's docstring, name,
+ # and attributes.
self.verify_tag(inclusion.inclusion_no_params, 'inclusion_no_params')
self.verify_tag(inclusion.inclusion_one_param, 'inclusion_one_param')
self.verify_tag(inclusion.inclusion_explicit_no_context, 'inclusion_explicit_no_context')
@@ -273,7 +275,7 @@ class InclusionTagTests(TagTestCase):
def test_15070_use_l10n(self):
"""
- Test that inclusion tag passes down `use_l10n` of context to the
+ Inclusion tag passes down `use_l10n` of context to the
Context of the included/rendered template as well.
"""
c = Context({})
@@ -313,7 +315,8 @@ class AssignmentTagTests(TagTestCase):
self.assertEqual(t.render(c), 'The result is: assignment_no_params - Expected result')
def test_assignment_tag_registration(self):
- # Test that the decorators preserve the decorated function's docstring, name and attributes.
+ # The decorators preserve the decorated function's docstring, name,
+ # and attributes.
self.verify_tag(custom.assignment_no_params, 'assignment_no_params')
def test_assignment_tag_missing_context(self):
diff --git a/tests/template_tests/test_engine.py b/tests/template_tests/test_engine.py
index 61ab7259ea..3b65dcb4f2 100644
--- a/tests/template_tests/test_engine.py
+++ b/tests/template_tests/test_engine.py
@@ -30,7 +30,7 @@ class LoaderTests(SimpleTestCase):
def test_loader_priority(self):
"""
- #21460 -- Check that the order of template loader works.
+ #21460 -- The order of template loader works.
"""
loaders = [
'django.template.loaders.filesystem.Loader',
@@ -42,7 +42,7 @@ class LoaderTests(SimpleTestCase):
def test_cached_loader_priority(self):
"""
- Check that the order of template loader works. Refs #21460.
+ The order of template loader works. Refs #21460.
"""
loaders = [
('django.template.loaders.cached.Loader', [
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 8d28c0816d..d3eb782347 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -103,9 +103,8 @@ class ClientTest(TestCase):
def test_response_attached_request(self):
"""
- Check that the returned response has a ``request`` attribute with the
- originating environ dict and a ``wsgi_request`` with the originating
- ``WSGIRequest`` instance.
+ The returned response has a ``request`` attribute with the originating
+ environ dict and a ``wsgi_request`` with the originating WSGIRequest.
"""
response = self.client.get("/header_view/")
@@ -164,34 +163,28 @@ class ClientTest(TestCase):
def test_redirect(self):
"GET a URL that redirects elsewhere"
response = self.client.get('/redirect_view/')
- # Check that the response was a 302 (redirect)
self.assertRedirects(response, '/get_view/')
def test_redirect_with_query(self):
"GET a URL that redirects with given GET parameters"
response = self.client.get('/redirect_view/', {'var': 'value'})
-
- # Check if parameters are intact
self.assertRedirects(response, '/get_view/?var=value')
def test_permanent_redirect(self):
"GET a URL that redirects permanently elsewhere"
response = self.client.get('/permanent_redirect_view/')
- # Check that the response was a 301 (permanent redirect)
self.assertRedirects(response, '/get_view/', status_code=301)
def test_temporary_redirect(self):
"GET a URL that does a non-permanent redirect"
response = self.client.get('/temporary_redirect_view/')
- # Check that the response was a 302 (non-permanent redirect)
self.assertRedirects(response, '/get_view/', status_code=302)
def test_redirect_to_strange_location(self):
"GET a URL that redirects to a non-200 page"
response = self.client.get('/double_redirect_view/')
-
- # Check that the response was a 302, and that
- # the attempt to get the redirection location returned 301 when retrieved
+ # The response was a 302, and that the attempt to get the redirection
+ # location returned 301 when retrieved
self.assertRedirects(response, '/permanent_redirect_view/', target_status_code=301)
def test_follow_redirect(self):
@@ -225,8 +218,6 @@ class ClientTest(TestCase):
def test_notfound_response(self):
"GET a URL that responds as '404:Not Found'"
response = self.client.get('/bad_view/')
-
- # Check that the response was a 404, and that the content contains MAGIC
self.assertContains(response, 'MAGIC', status_code=404)
def test_valid_form(self):
@@ -251,7 +242,7 @@ class ClientTest(TestCase):
response = self.client.get('/form_view/', data=hints)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "Form GET Template")
- # Check that the multi-value data has been rolled out ok
+ # The multi-value data has been rolled out ok
self.assertContains(response, 'Select a valid choice.', 0)
def test_incomplete_data_form(self):
@@ -336,14 +327,14 @@ class ClientTest(TestCase):
"GET an invalid URL"
response = self.client.get('/unknown_view/')
- # Check that the response was a 404
+ # The response was a 404
self.assertEqual(response.status_code, 404)
def test_url_parameters(self):
"Make sure that URL ;-parameters are not stripped."
response = self.client.get('/unknown_view/;some-parameter')
- # Check that the path in the response includes it (ignore that it's a 404)
+ # The path in the response includes it (ignore that it's a 404)
self.assertEqual(response.request['PATH_INFO'], '/unknown_view/;some-parameter')
def test_view_with_login(self):
@@ -617,7 +608,7 @@ class ClientTest(TestCase):
def test_external_redirect_with_fetch_error_msg(self):
"""
- Check that assertRedirects without fetch_redirect_response=False raises
+ assertRedirects without fetch_redirect_response=False raises
a relevant ValueError rather than a non-descript AssertionError.
"""
response = self.client.get('/django_project_redirect/')
@@ -637,7 +628,7 @@ class ClientTest(TestCase):
self.client.session['tobacconist']
self.client.post('/session_view/')
- # Check that the session was modified
+ # The session was modified
self.assertEqual(self.client.session['tobacconist'], 'hovercraft')
@override_settings(
@@ -661,8 +652,7 @@ class ClientTest(TestCase):
self.client.get("/broken_view/")
def test_mail_sending(self):
- "Test that mail is redirected to a dummy outbox during test setup"
-
+ "Mail is redirected to a dummy outbox during test setup"
response = self.client.get('/mail_sending_view/')
self.assertEqual(response.status_code, 200)
@@ -674,7 +664,7 @@ class ClientTest(TestCase):
self.assertEqual(mail.outbox[0].to[1], 'second@example.com')
def test_reverse_lazy_decodes(self):
- "Ensure reverse_lazy works in the test client"
+ "reverse_lazy() works in the test client"
data = {'var': 'data'}
response = self.client.get(reverse_lazy('get_view'), data)
@@ -690,8 +680,7 @@ class ClientTest(TestCase):
self.assertRedirects(response, '/accounts/login/')
def test_mass_mail_sending(self):
- "Test that mass mail is redirected to a dummy outbox during test setup"
-
+ "Mass mail is redirected to a dummy outbox during test setup"
response = self.client.get('/mass_mail_sending_view/')
self.assertEqual(response.status_code, 200)
@@ -736,11 +725,9 @@ class CSRFEnabledClientTests(SimpleTestCase):
def test_csrf_enabled_client(self):
"A client can be instantiated with CSRF checks enabled"
csrf_client = Client(enforce_csrf_checks=True)
-
# The normal client allows the post
response = self.client.post('/post_view/', {})
self.assertEqual(response.status_code, 200)
-
# The CSRF-enabled client rejects it
response = csrf_client.post('/post_view/', {})
self.assertEqual(response.status_code, 403)
@@ -787,7 +774,6 @@ class RequestFactoryTest(SimpleTestCase):
method = getattr(self.request_factory, method_name)
request = method('/somewhere/')
response = view(request)
-
self.assertEqual(response.status_code, 200)
def test_get_request_from_factory(self):
@@ -796,7 +782,6 @@ class RequestFactoryTest(SimpleTestCase):
"""
request = self.request_factory.get('/somewhere/')
response = get_view(request)
-
self.assertContains(response, 'This is a test')
def test_trace_request_from_factory(self):
@@ -806,5 +791,4 @@ class RequestFactoryTest(SimpleTestCase):
response = trace_view(request)
protocol = request.META["SERVER_PROTOCOL"]
echoed_request_line = "TRACE {} {}".format(url_path, protocol)
-
self.assertContains(response, echoed_request_line)
diff --git a/tests/test_client/views.py b/tests/test_client/views.py
index 6e7d3a37d5..41106d78ff 100644
--- a/tests/test_client/views.py
+++ b/tests/test_client/views.py
@@ -176,7 +176,7 @@ def form_view_with_template(request):
class BaseTestFormSet(BaseFormSet):
def clean(self):
- """Checks that no two email addresses are the same."""
+ """No two email addresses are the same."""
if any(self.errors):
# Don't bother validating the formset unless each form is valid
return
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index c45afc1244..7c4c8cde24 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -167,16 +167,15 @@ class AssertContainsTests(SimpleTestCase):
self.assertNotContains(r, ugettext_lazy('never'))
def test_assert_contains_renders_template_response(self):
- """ Test that we can pass in an unrendered SimpleTemplateResponse
- without throwing an error.
- Refs #15826.
+ """
+ An unrendered SimpleTemplateResponse may be used in assertContains().
"""
template = engines['django'].from_string('Hello')
response = SimpleTemplateResponse(template)
self.assertContains(response, 'Hello')
def test_assert_contains_using_non_template_response(self):
- """ Test that auto-rendering does not affect responses that aren't
+ """ auto-rendering does not affect responses that aren't
instances (or subclasses) of SimpleTemplateResponse.
Refs #15826.
"""
@@ -184,18 +183,17 @@ class AssertContainsTests(SimpleTestCase):
self.assertContains(response, 'Hello')
def test_assert_not_contains_renders_template_response(self):
- """ Test that we can pass in an unrendered SimpleTemplateResponse
- without throwing an error.
- Refs #15826.
+ """
+ An unrendered SimpleTemplateResponse may be used in assertNotContains().
"""
template = engines['django'].from_string('Hello')
response = SimpleTemplateResponse(template)
self.assertNotContains(response, 'Bye')
def test_assert_not_contains_using_non_template_response(self):
- """ Test that auto-rendering does not affect responses that aren't
- instances (or subclasses) of SimpleTemplateResponse.
- Refs #15826.
+ """
+ auto-rendering does not affect responses that aren't instances (or
+ subclasses) of SimpleTemplateResponse.
"""
response = HttpResponse('Hello')
self.assertNotContains(response, 'Bye')
@@ -208,7 +206,7 @@ class AssertTemplateUsedTests(TestDataMixin, TestCase):
"Template usage assertions work then templates aren't in use"
response = self.client.get('/no_template_view/')
- # Check that the no template case doesn't mess with the template assertions
+ # The no template case doesn't mess with the template assertions
self.assertTemplateNotUsed(response, 'GET Template')
try:
@@ -519,7 +517,7 @@ class AssertRedirectsTests(SimpleTestCase):
@ignore_warnings(category=RemovedInDjango20Warning)
def test_full_path_in_expected_urls(self):
"""
- Test that specifying a full URL as assertRedirects expected_url still
+ Specifying a full URL as assertRedirects expected_url still
work as backwards compatible behavior until Django 2.0.
"""
response = self.client.get('/redirect_view/')
@@ -631,8 +629,8 @@ class AssertFormErrorTests(SimpleTestCase):
def test_unknown_nonfield_error(self):
"""
- Checks that an assertion is raised if the form's non field errors
- doesn't contain the provided error.
+ An assertion is raised if the form's non field errors doesn't contain
+ the provided error.
"""
post_data = {
'text': 'Hello World',
@@ -806,7 +804,7 @@ class AssertFormsetErrorTests(SimpleTestCase):
class LoginTests(TestDataMixin, TestCase):
def test_login_different_client(self):
- "Check that using a different test client doesn't violate authentication"
+ "Using a different test client doesn't violate authentication"
# Create a second client, and log in.
c = Client()
@@ -817,8 +815,7 @@ class LoginTests(TestDataMixin, TestCase):
response = c.get("/login_protected_redirect_view/")
# At this points, the self.client isn't logged in.
- # Check that assertRedirects uses the original client, not the
- # default client.
+ # assertRedirects uses the original client, not the default client.
self.assertRedirects(response, "/get_view/")
@@ -1004,7 +1001,7 @@ class SessionTests(TestDataMixin, TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, b'set_session')
- # Check that the session has been modified
+ # The session has been modified
response = self.client.get('/check_session/')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, b'YES')
@@ -1223,9 +1220,8 @@ class RequestMethodStringDataTests(SimpleTestCase):
class QueryStringTests(SimpleTestCase):
def test_get_like_requests(self):
- # See: https://code.djangoproject.com/ticket/10571.
for method_name in ('get', 'head'):
- # A GET-like request can pass a query string as data
+ # A GET-like request can pass a query string as data (#10571)
method = getattr(self.client, method_name)
response = method("/request_data/", data={'foo': 'whiz'})
self.assertEqual(response.context['get-foo'], 'whiz')
@@ -1344,8 +1340,8 @@ class RequestHeadersTest(SimpleTestCase):
@override_settings(ROOT_URLCONF='test_client_regress.urls')
class ReadLimitedStreamTest(SimpleTestCase):
"""
- Tests that ensure that HttpRequest.body, HttpRequest.read() and
- HttpRequest.read(BUFFER) have proper LimitedStream behavior.
+ HttpRequest.body, HttpRequest.read(), and HttpRequest.read(BUFFER) have
+ proper LimitedStream behavior.
Refs #14753, #15785
"""
diff --git a/tests/test_runner/test_parallel.py b/tests/test_runner/test_parallel.py
index 8118734994..b888dc62af 100644
--- a/tests/test_runner/test_parallel.py
+++ b/tests/test_runner/test_parallel.py
@@ -31,7 +31,7 @@ class ParallelTestRunnerTest(SimpleTestCase):
@unittest.skipUnless(six.PY3, 'subtests were added in Python 3.4')
def test_subtest(self):
"""
- Check that passing subtests work.
+ Passing subtests work.
"""
for i in range(2):
with self.subTest(index=i):
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py
index 15417db645..a913e87d09 100644
--- a/tests/test_runner/tests.py
+++ b/tests/test_runner/tests.py
@@ -236,7 +236,7 @@ class Sqlite3InMemoryTestDbs(TestCase):
class DummyBackendTest(unittest.TestCase):
def test_setup_databases(self):
"""
- Test that setup_databases() doesn't fail with dummy database backend.
+ setup_databases() doesn't fail with dummy database backend.
"""
tested_connections = db.ConnectionHandler({})
with mock.patch('django.test.utils.connections', new=tested_connections):
@@ -248,7 +248,7 @@ class DummyBackendTest(unittest.TestCase):
class AliasedDefaultTestSetupTest(unittest.TestCase):
def test_setup_aliased_default_database(self):
"""
- Test that setup_datebases() doesn't fail when 'default' is aliased
+ setup_datebases() doesn't fail when 'default' is aliased
"""
tested_connections = db.ConnectionHandler({
'default': {
@@ -353,7 +353,7 @@ class AutoIncrementResetTest(TransactionTestCase):
class EmptyDefaultDatabaseTest(unittest.TestCase):
def test_empty_default_database(self):
"""
- Test that an empty default database in settings does not raise an ImproperlyConfigured
+ An empty default database in settings does not raise an ImproperlyConfigured
error when running a unit test that does not use a database.
"""
testcases.connections = db.ConnectionHandler({'default': {}})
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index 1fb70e2aa3..969cbf7659 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -202,7 +202,7 @@ class AssertQuerysetEqualTests(TestCase):
def test_repeated_values(self):
"""
- Test that assertQuerysetEqual checks the number of appearance of each item
+ assertQuerysetEqual checks the number of appearance of each item
when used with option ordered=False.
"""
batmobile = Car.objects.create(name='Batmobile')
diff --git a/tests/update/tests.py b/tests/update/tests.py
index 89593f8dfc..ca1c5ac4f9 100644
--- a/tests/update/tests.py
+++ b/tests/update/tests.py
@@ -17,7 +17,7 @@ class SimpleTest(TestCase):
def test_nonempty_update(self):
"""
- Test that update changes the right number of rows for a nonempty queryset
+ Update changes the right number of rows for a nonempty queryset
"""
num_updated = self.a1.b_set.update(y=100)
self.assertEqual(num_updated, 20)
@@ -26,7 +26,7 @@ class SimpleTest(TestCase):
def test_empty_update(self):
"""
- Test that update changes the right number of rows for an empty queryset
+ Update changes the right number of rows for an empty queryset
"""
num_updated = self.a2.b_set.update(y=100)
self.assertEqual(num_updated, 0)
@@ -35,7 +35,7 @@ class SimpleTest(TestCase):
def test_nonempty_update_with_inheritance(self):
"""
- Test that update changes the right number of rows for an empty queryset
+ Update changes the right number of rows for an empty queryset
when the update affects only a base table
"""
num_updated = self.a1.d_set.update(y=100)
@@ -45,7 +45,7 @@ class SimpleTest(TestCase):
def test_empty_update_with_inheritance(self):
"""
- Test that update changes the right number of rows for an empty queryset
+ Update changes the right number of rows for an empty queryset
when the update affects only a base table
"""
num_updated = self.a2.d_set.update(y=100)
@@ -55,7 +55,7 @@ class SimpleTest(TestCase):
def test_foreign_key_update_with_id(self):
"""
- Test that update works using _id for foreign keys
+ Update works using _id for foreign keys
"""
num_updated = self.a1.d_set.update(a_id=self.a2)
self.assertEqual(num_updated, 20)
diff --git a/tests/update_only_fields/tests.py b/tests/update_only_fields/tests.py
index 172cd64f5d..c2b809b328 100644
--- a/tests/update_only_fields/tests.py
+++ b/tests/update_only_fields/tests.py
@@ -72,7 +72,7 @@ class UpdateOnlyFieldsTests(TestCase):
s1.gender = 'M'
with self.assertNumQueries(1):
s1.save()
- # Test that the deferred class does not remember that gender was
+ # The deferred class does not remember that gender was
# set, instead the instance should remember this.
s1 = Person.objects.only('name').get(pk=s.pk)
with self.assertNumQueries(1):
diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py
index 522899e886..ca894fcc8e 100644
--- a/tests/urlpatterns_reverse/tests.py
+++ b/tests/urlpatterns_reverse/tests.py
@@ -363,12 +363,10 @@ class ResolverTests(SimpleTestCase):
def test_non_regex(self):
"""
- Verifies that we raise a Resolver404 if what we are resolving doesn't
- meet the basic requirements of a path to match - i.e., at the very
- least, it matches the root pattern '^/'. We must never return None
- from resolve, or we will get a TypeError further down the line.
-
- Regression for #10834.
+ A Resolver404 is raised if resolving doesn't meet the basic
+ requirements of a path to match - i.e., at the very least, it matches
+ the root pattern '^/'. Never return None from resolve() to prevent a
+ TypeError from occuring later (#10834).
"""
with self.assertRaises(Resolver404):
resolve('')
@@ -381,9 +379,9 @@ class ResolverTests(SimpleTestCase):
def test_404_tried_urls_have_names(self):
"""
- Verifies that the list of URLs that come back from a Resolver404
- exception contains a list in the right format for printing out in
- the DEBUG 404 page with both the patterns and URL names, if available.
+ The list of URLs that come back from a Resolver404 exception contains
+ a list in the right format for printing out in the DEBUG 404 page with
+ both the patterns and URL names, if available.
"""
urls = 'urlpatterns_reverse.named_urls'
# this list matches the expected URL types and names returned when
@@ -480,7 +478,7 @@ class ReverseLazyTest(TestCase):
class ReverseLazySettingsTest(AdminScriptTestCase):
"""
- Test that reverse_lazy can be used in settings without causing a circular
+ reverse_lazy can be used in settings without causing a circular
import error.
"""
def setUp(self):
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py
index d448e55869..8c37aed100 100644
--- a/tests/user_commands/tests.py
+++ b/tests/user_commands/tests.py
@@ -45,7 +45,7 @@ class CommandTests(SimpleTestCase):
self.assertEqual(translation.get_language(), 'fr')
def test_explode(self):
- """ Test that an unknown command raises CommandError """
+ """ An unknown command raises CommandError """
with self.assertRaises(CommandError):
management.call_command(('explode',))
@@ -86,7 +86,7 @@ class CommandTests(SimpleTestCase):
def test_discover_commands_in_eggs(self):
"""
- Test that management commands can also be loaded from Python eggs.
+ Management commands can also be loaded from Python eggs.
"""
egg_dir = '%s/eggs' % os.path.dirname(upath(__file__))
egg_name = '%s/basic.egg' % egg_dir
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index 6b60f00ede..b81ba351f0 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -42,7 +42,7 @@ class TestFilenameGenerator(SimpleTestCase):
def test_django_locales(self):
"""
- Test that gen_filenames() yields the built-in Django locale files.
+ gen_filenames() yields the built-in Django locale files.
"""
django_dir = os.path.join(os.path.dirname(conf.__file__), 'locale')
django_mo = os.path.join(django_dir, 'nl', 'LC_MESSAGES', 'django.mo')
@@ -51,7 +51,7 @@ class TestFilenameGenerator(SimpleTestCase):
@override_settings(LOCALE_PATHS=[LOCALE_PATH])
def test_locale_paths_setting(self):
"""
- Test that gen_filenames also yields from LOCALE_PATHS locales.
+ gen_filenames also yields from LOCALE_PATHS locales.
"""
locale_paths_mo = os.path.join(LOCALE_PATH, 'nl', 'LC_MESSAGES', 'django.mo')
self.assertFileFound(locale_paths_mo)
@@ -59,8 +59,7 @@ class TestFilenameGenerator(SimpleTestCase):
@override_settings(INSTALLED_APPS=[])
def test_project_root_locale(self):
"""
- Test that gen_filenames also yields from the current directory (project
- root).
+ gen_filenames() also yields from the current directory (project root).
"""
old_cwd = os.getcwd()
os.chdir(os.path.dirname(__file__))
@@ -74,7 +73,7 @@ class TestFilenameGenerator(SimpleTestCase):
@override_settings(INSTALLED_APPS=['django.contrib.admin'])
def test_app_locales(self):
"""
- Test that gen_filenames also yields from locale dirs in installed apps.
+ gen_filenames() also yields from locale dirs in installed apps.
"""
admin_dir = os.path.join(os.path.dirname(admin.__file__), 'locale')
admin_mo = os.path.join(admin_dir, 'nl', 'LC_MESSAGES', 'django.mo')
diff --git a/tests/utils_tests/test_datetime_safe.py b/tests/utils_tests/test_datetime_safe.py
index d86a60400b..5fa08bc4f4 100644
--- a/tests/utils_tests/test_datetime_safe.py
+++ b/tests/utils_tests/test_datetime_safe.py
@@ -56,6 +56,6 @@ class DatetimeTests(unittest.TestCase):
"""
Regression for #12524
- Check that pre-1000AD dates are padded with zeros if necessary
+ Pre-1000AD dates are padded with zeros if necessary
"""
self.assertEqual(date(1, 1, 1).strftime("%Y/%m/%d was a %A"), '0001/01/01 was a Monday')
diff --git a/tests/utils_tests/test_decorators.py b/tests/utils_tests/test_decorators.py
index 6135eb1994..06c6dc1cd2 100644
--- a/tests/utils_tests/test_decorators.py
+++ b/tests/utils_tests/test_decorators.py
@@ -65,9 +65,8 @@ class DecoratorFromMiddlewareTests(SimpleTestCase):
def test_full_dec_normal(self):
"""
- Test that all methods of middleware are called for normal HttpResponses
+ All methods of middleware are called for normal HttpResponses
"""
-
@full_dec
def normal_view(request):
template = engines['django'].from_string("Hello world")
@@ -83,10 +82,9 @@ class DecoratorFromMiddlewareTests(SimpleTestCase):
def test_full_dec_templateresponse(self):
"""
- Test that all methods of middleware are called for TemplateResponses in
+ All methods of middleware are called for TemplateResponses in
the right sequence.
"""
-
@full_dec
def template_response_view(request):
template = engines['django'].from_string("Hello world")
@@ -105,7 +103,7 @@ class DecoratorFromMiddlewareTests(SimpleTestCase):
self.assertFalse(getattr(request, 'process_response_reached', False))
response.render()
self.assertTrue(getattr(request, 'process_response_reached', False))
- # Check that process_response saw the rendered content
+ # process_response saw the rendered content
self.assertEqual(request.process_response_content, b"Hello world")
diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py
index 5ddb18d069..688b46194d 100644
--- a/tests/utils_tests/test_encoding.py
+++ b/tests/utils_tests/test_encoding.py
@@ -16,7 +16,7 @@ from django.utils.http import urlquote_plus
class TestEncodingUtils(unittest.TestCase):
def test_force_text_exception(self):
"""
- Check that broken __unicode__/__str__ actually raises an error.
+ Broken __unicode__/__str__ actually raises an error.
"""
class MyString(object):
def __str__(self):
@@ -36,7 +36,7 @@ class TestEncodingUtils(unittest.TestCase):
def test_force_bytes_exception(self):
"""
- Test that force_bytes knows how to convert to bytes an exception
+ force_bytes knows how to convert to bytes an exception
containing non-ASCII characters in its args.
"""
error_msg = "This is an exception, voilà"
diff --git a/tests/utils_tests/test_feedgenerator.py b/tests/utils_tests/test_feedgenerator.py
index b72f250c02..9b249295c3 100644
--- a/tests/utils_tests/test_feedgenerator.py
+++ b/tests/utils_tests/test_feedgenerator.py
@@ -15,7 +15,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_get_tag_uri(self):
"""
- Test get_tag_uri() correctly generates TagURIs.
+ get_tag_uri() correctly generates TagURIs.
"""
self.assertEqual(
feedgenerator.get_tag_uri('http://example.org/foo/bar#headline', datetime.date(2004, 10, 25)),
@@ -23,8 +23,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_get_tag_uri_with_port(self):
"""
- Test that get_tag_uri() correctly generates TagURIs from URLs with port
- numbers.
+ get_tag_uri() correctly generates TagURIs from URLs with port numbers.
"""
self.assertEqual(
feedgenerator.get_tag_uri(
@@ -35,7 +34,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_rfc2822_date(self):
"""
- Test rfc2822_date() correctly formats datetime objects.
+ rfc2822_date() correctly formats datetime objects.
"""
self.assertEqual(
feedgenerator.rfc2822_date(datetime.datetime(2008, 11, 14, 13, 37, 0)),
@@ -44,7 +43,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_rfc2822_date_with_timezone(self):
"""
- Test rfc2822_date() correctly formats datetime objects with tzinfo.
+ rfc2822_date() correctly formats datetime objects with tzinfo.
"""
self.assertEqual(
feedgenerator.rfc2822_date(datetime.datetime(2008, 11, 14, 13, 37, 0, tzinfo=get_fixed_timezone(60))),
@@ -53,7 +52,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_rfc2822_date_without_time(self):
"""
- Test rfc2822_date() correctly formats date objects.
+ rfc2822_date() correctly formats date objects.
"""
self.assertEqual(
feedgenerator.rfc2822_date(datetime.date(2008, 11, 14)),
@@ -62,7 +61,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_rfc3339_date(self):
"""
- Test rfc3339_date() correctly formats datetime objects.
+ rfc3339_date() correctly formats datetime objects.
"""
self.assertEqual(
feedgenerator.rfc3339_date(datetime.datetime(2008, 11, 14, 13, 37, 0)),
@@ -71,7 +70,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_rfc3339_date_with_timezone(self):
"""
- Test rfc3339_date() correctly formats datetime objects with tzinfo.
+ rfc3339_date() correctly formats datetime objects with tzinfo.
"""
self.assertEqual(
feedgenerator.rfc3339_date(datetime.datetime(2008, 11, 14, 13, 37, 0, tzinfo=get_fixed_timezone(120))),
@@ -80,7 +79,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_rfc3339_date_without_time(self):
"""
- Test rfc3339_date() correctly formats date objects.
+ rfc3339_date() correctly formats date objects.
"""
self.assertEqual(
feedgenerator.rfc3339_date(datetime.date(2008, 11, 14)),
@@ -89,7 +88,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_atom1_mime_type(self):
"""
- Test to make sure Atom MIME type has UTF8 Charset parameter set
+ Atom MIME type has UTF8 Charset parameter set
"""
atom_feed = feedgenerator.Atom1Feed("title", "link", "description")
self.assertEqual(
@@ -98,7 +97,7 @@ class FeedgeneratorTest(unittest.TestCase):
def test_rss_mime_type(self):
"""
- Test to make sure RSS MIME type has UTF8 Charset parameter set
+ RSS MIME type has UTF8 Charset parameter set
"""
rss_feed = feedgenerator.Rss201rev2Feed("title", "link", "description")
self.assertEqual(
diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py
index f62784f1b0..1413ac23b3 100644
--- a/tests/utils_tests/test_functional.py
+++ b/tests/utils_tests/test_functional.py
@@ -14,8 +14,7 @@ class FunctionalTestCase(unittest.TestCase):
self.assertEqual(a, b)
def test_lazy_base_class(self):
- """Test that lazy also finds base class methods in the proxy object"""
-
+ """lazy also finds base class methods in the proxy object"""
class Base(object):
def base_method(self):
pass
@@ -27,8 +26,7 @@ class FunctionalTestCase(unittest.TestCase):
self.assertIn('base_method', dir(t))
def test_lazy_base_class_override(self):
- """Test that lazy finds the correct (overridden) method implementation"""
-
+ """lazy finds the correct (overridden) method implementation"""
class Base(object):
def method(self):
return 'Base'
@@ -81,10 +79,8 @@ class FunctionalTestCase(unittest.TestCase):
def test_cached_property(self):
"""
- Test that cached_property caches its value,
- and that it behaves like a property
+ cached_property caches its value and that it behaves like a property
"""
-
class A(object):
@cached_property
@@ -121,9 +117,8 @@ class FunctionalTestCase(unittest.TestCase):
def test_lazy_equality(self):
"""
- Tests that == and != work correctly for Promises.
+ == and != work correctly for Promises.
"""
-
lazy_a = lazy(lambda: 4, int)
lazy_b = lazy(lambda: 4, int)
lazy_c = lazy(lambda: 5, int)
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index 20de85148e..39d590032f 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -15,8 +15,8 @@ class TestUtilsHtml(SimpleTestCase):
def check_output(self, function, value, output=None):
"""
- Check that function(value) equals output. If output is None,
- check that function(value) equals value.
+ function(value) equals output. If output is None, function(value)
+ equals value.
"""
if output is None:
output = value
@@ -149,10 +149,10 @@ class TestUtilsHtml(SimpleTestCase):
def test_smart_urlquote(self):
quote = html.smart_urlquote
- # Ensure that IDNs are properly quoted
+ # IDNs are properly quoted
self.assertEqual(quote('http://öäü.com/'), 'http://xn--4ca9at.com/')
self.assertEqual(quote('http://öäü.com/öäü/'), 'http://xn--4ca9at.com/%C3%B6%C3%A4%C3%BC/')
- # Ensure that everything unsafe is quoted, !*'();:@&=+$,/?#[]~ is considered safe as per RFC
+ # Everything unsafe is quoted, !*'();:@&=+$,/?#[]~ is considered safe as per RFC
self.assertEqual(quote('http://example.com/path/öäü/'), 'http://example.com/path/%C3%B6%C3%A4%C3%BC/')
self.assertEqual(quote('http://example.com/%C3%B6/ä/'), 'http://example.com/%C3%B6/%C3%A4/')
self.assertEqual(quote('http://example.com/?x=1&y=2+3&z='), 'http://example.com/?x=1&y=2+3&z=')
diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py
index 1ce993bdb2..3dfc33a120 100644
--- a/tests/utils_tests/test_text.py
+++ b/tests/utils_tests/test_text.py
@@ -56,14 +56,11 @@ class TestUtilsText(SimpleTestCase):
self.assertEqual(list(text.smart_split(test)), expected)
def test_truncate_chars(self):
- truncator = text.Truncator(
- 'The quick brown fox jumped over the lazy dog.'
- )
+ truncator = text.Truncator('The quick brown fox jumped over the lazy dog.')
self.assertEqual('The quick brown fox jumped over the lazy dog.', truncator.chars(100)),
self.assertEqual('The quick brown fox ...', truncator.chars(23)),
self.assertEqual('The quick brown fo.....', truncator.chars(23, '.....')),
- # Ensure that we normalize our unicode data first
nfc = text.Truncator('o\xfco\xfco\xfco\xfc')
nfd = text.Truncator('ou\u0308ou\u0308ou\u0308ou\u0308')
self.assertEqual('oüoüoüoü', nfc.chars(8))
@@ -88,7 +85,7 @@ class TestUtilsText(SimpleTestCase):
# Make a best effort to shorten to the desired length, but requesting
# a length shorter than the ellipsis shouldn't break
self.assertEqual('...', text.Truncator('asdf').chars(1))
- # Ensure that lazy strings are handled correctly
+ # lazy strings are handled correctly
self.assertEqual(text.Truncator(lazystr('The quick brown fox')).chars(12), 'The quick...')
def test_truncate_words(self):
@@ -96,7 +93,7 @@ class TestUtilsText(SimpleTestCase):
self.assertEqual('The quick brown fox jumped over the lazy dog.', truncator.words(10))
self.assertEqual('The quick brown fox...', truncator.words(4))
self.assertEqual('The quick brown fox[snip]', truncator.words(4, '[snip]'))
- # Ensure that lazy strings are handled correctly
+ # lazy strings are handled correctly
truncator = text.Truncator(lazystr('The quick brown fox jumped over the lazy dog.'))
self.assertEqual('The quick brown fox...', truncator.words(4))
diff --git a/tests/validators/tests.py b/tests/validators/tests.py
index 88273eaae1..2475131d28 100644
--- a/tests/validators/tests.py
+++ b/tests/validators/tests.py
@@ -349,7 +349,7 @@ for validator, value, expected in TEST_DATA:
class TestValidatorEquality(TestCase):
"""
- Tests that validators have valid equality operators (#21638)
+ Validators have valid equality operators (#21638)
"""
def test_regex_equality(self):
diff --git a/tests/view_tests/tests/test_csrf.py b/tests/view_tests/tests/test_csrf.py
index fdd9715476..23dab04cd6 100644
--- a/tests/view_tests/tests/test_csrf.py
+++ b/tests/view_tests/tests/test_csrf.py
@@ -25,7 +25,7 @@ class CsrfViewTests(SimpleTestCase):
)
def test_translation(self):
"""
- Test that an invalid request is rejected with a localized error message.
+ An invalid request is rejected with a localized error message.
"""
response = self.client.post('/')
self.assertContains(response, "Forbidden", status_code=403)
@@ -52,7 +52,7 @@ class CsrfViewTests(SimpleTestCase):
)
def test_translation_middleware_classes(self):
"""
- Test that an invalid request is rejected with a localized error message.
+ An invalid request is rejected with a localized error message.
"""
response = self.client.post('/')
self.assertContains(response, "Forbidden", status_code=403)
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index 2f6f164b24..3fe89d9bf3 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -80,7 +80,7 @@ class DebugViewTests(LoggingCaptureMixin, SimpleTestCase):
self.assertNotContains(response, 'haha', status_code=500)
def test_400(self):
- # Ensure that when DEBUG=True, technical_500_template() is called.
+ # When DEBUG=True, technical_500_template() is called.
response = self.client.get('/raises400/')
self.assertContains(response, '