summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/admin_changelist/tests.py24
-rw-r--r--tests/admin_checks/tests.py9
-rw-r--r--tests/admin_custom_urls/tests.py19
-rw-r--r--tests/admin_filters/tests.py6
-rw-r--r--tests/admin_inlines/tests.py45
-rw-r--r--tests/admin_ordering/tests.py2
-rw-r--r--tests/admin_scripts/tests.py6
-rw-r--r--tests/admin_utils/tests.py8
-rw-r--r--tests/admin_views/admin.py2
-rw-r--r--tests/admin_views/tests.py205
-rw-r--r--tests/admin_widgets/tests.py62
-rw-r--r--tests/aggregation/tests.py11
-rw-r--r--tests/aggregation_regress/tests.py30
-rw-r--r--tests/annotations/tests.py8
-rw-r--r--tests/apps/tests.py6
-rw-r--r--tests/auth_tests/test_auth_backends.py32
-rw-r--r--tests/auth_tests/test_basic.py4
-rw-r--r--tests/auth_tests/test_context_processors.py8
-rw-r--r--tests/auth_tests/test_decorators.py12
-rw-r--r--tests/auth_tests/test_deprecated_views.py4
-rw-r--r--tests/auth_tests/test_forms.py2
-rw-r--r--tests/auth_tests/test_handlers.py9
-rw-r--r--tests/auth_tests/test_hashers.py10
-rw-r--r--tests/auth_tests/test_mixins.py4
-rw-r--r--tests/auth_tests/test_models.py2
-rw-r--r--tests/auth_tests/test_remote_user.py10
-rw-r--r--tests/auth_tests/test_signals.py2
-rw-r--r--tests/auth_tests/test_tokens.py9
-rw-r--r--tests/auth_tests/test_views.py19
-rw-r--r--tests/backends/tests.py58
-rw-r--r--tests/basic/tests.py7
-rw-r--r--tests/builtin_server/tests.py7
-rw-r--r--tests/cache/tests.py46
-rw-r--r--tests/contenttypes_tests/test_models.py23
-rw-r--r--tests/contenttypes_tests/tests.py4
-rw-r--r--tests/context_processors/tests.py2
-rw-r--r--tests/csrf_tests/tests.py37
-rw-r--r--tests/custom_managers/tests.py20
-rw-r--r--tests/decorators/tests.py11
-rw-r--r--tests/defer/tests.py3
-rw-r--r--tests/delete/tests.py2
-rw-r--r--tests/expressions/tests.py12
-rw-r--r--tests/extra_regress/tests.py2
-rw-r--r--tests/file_storage/tests.py13
-rw-r--r--tests/file_uploads/tests.py4
-rw-r--r--tests/file_uploads/views.py3
-rw-r--r--tests/files/tests.py8
-rw-r--r--tests/fixtures/tests.py12
-rw-r--r--tests/fixtures_regress/tests.py20
-rw-r--r--tests/foreign_object/test_empty_join.py2
-rw-r--r--tests/foreign_object/tests.py1
-rw-r--r--tests/forms_tests/tests/test_forms.py20
-rw-r--r--tests/forms_tests/tests/test_formsets.py9
-rw-r--r--tests/forms_tests/tests/test_input_formats.py144
-rw-r--r--tests/forms_tests/tests/test_media.py2
-rw-r--r--tests/forms_tests/tests/test_utils.py2
-rw-r--r--tests/forms_tests/tests/test_widgets.py2
-rw-r--r--tests/forms_tests/tests/tests.py6
-rw-r--r--tests/forms_tests/widget_tests/test_nullbooleanselect.py3
-rw-r--r--tests/generic_inline_admin/tests.py8
-rw-r--r--tests/generic_relations/tests.py11
-rw-r--r--tests/generic_relations_regress/tests.py14
-rw-r--r--tests/generic_views/test_base.py18
-rw-r--r--tests/generic_views/test_dates.py5
-rw-r--r--tests/generic_views/test_list.py2
-rw-r--r--tests/get_earliest_or_latest/tests.py45
-rw-r--r--tests/gis_tests/gdal_tests/test_raster.py2
-rw-r--r--tests/gis_tests/geoadmin/tests.py2
-rw-r--r--tests/gis_tests/geoapp/tests.py2
-rw-r--r--tests/gis_tests/gis_migrations/test_commands.py10
-rw-r--r--tests/gis_tests/layermap/tests.py2
-rw-r--r--tests/gis_tests/test_geoforms.py1
-rw-r--r--tests/gis_tests/tests.py4
-rw-r--r--tests/handlers/tests.py4
-rw-r--r--tests/httpwrappers/tests.py23
-rw-r--r--tests/i18n/patterns/tests.py7
-rw-r--r--tests/i18n/test_extraction.py14
-rw-r--r--tests/i18n/test_percents.py2
-rw-r--r--tests/i18n/tests.py33
-rw-r--r--tests/inspectdb/tests.py2
-rw-r--r--tests/introspection/tests.py3
-rw-r--r--tests/invalid_models_tests/test_relative_fields.py8
-rw-r--r--tests/known_related_objects/models.py2
-rw-r--r--tests/logging_tests/tests.py21
-rw-r--r--tests/lookup/tests.py17
-rw-r--r--tests/m2m_recursive/tests.py14
-rw-r--r--tests/m2m_signals/tests.py2
-rw-r--r--tests/m2m_through/tests.py2
-rw-r--r--tests/m2m_through_regress/tests.py5
-rw-r--r--tests/mail/tests.py35
-rw-r--r--tests/many_to_many/tests.py12
-rw-r--r--tests/many_to_one/tests.py10
-rw-r--r--tests/many_to_one_null/tests.py2
-rw-r--r--tests/messages_tests/base.py14
-rw-r--r--tests/messages_tests/test_cookie.py17
-rw-r--r--tests/messages_tests/test_fallback.py30
-rw-r--r--tests/messages_tests/test_session.py7
-rw-r--r--tests/middleware/tests.py4
-rw-r--r--tests/middleware_exceptions/test_legacy.py92
-rw-r--r--tests/migration_test_data_persistence/tests.py6
-rw-r--r--tests/migrations/test_autodetector.py80
-rw-r--r--tests/migrations/test_commands.py108
-rw-r--r--tests/migrations/test_executor.py6
-rw-r--r--tests/migrations/test_graph.py4
-rw-r--r--tests/migrations/test_multidb.py2
-rw-r--r--tests/migrations/test_operations.py26
-rw-r--r--tests/migrations/test_optimizer.py8
-rw-r--r--tests/migrations/test_state.py29
-rw-r--r--tests/model_fields/test_charfield.py2
-rw-r--r--tests/model_fields/test_imagefield.py12
-rw-r--r--tests/model_fields/test_textfield.py2
-rw-r--r--tests/model_fields/test_uuid.py2
-rw-r--r--tests/model_forms/tests.py17
-rw-r--r--tests/model_formsets/tests.py8
-rw-r--r--tests/model_inheritance/tests.py12
-rw-r--r--tests/model_inheritance_regress/models.py2
-rw-r--r--tests/model_inheritance_regress/tests.py30
-rw-r--r--tests/model_regress/tests.py12
-rw-r--r--tests/modeladmin/tests.py51
-rw-r--r--tests/multiple_database/tests.py45
-rw-r--r--tests/no_models/tests.py2
-rw-r--r--tests/one_to_one/tests.py14
-rw-r--r--tests/ordering/tests.py8
-rw-r--r--tests/pagination/tests.py9
-rw-r--r--tests/postgres_tests/test_unaccent.py4
-rw-r--r--tests/prefetch_related/test_prefetch_related_objects.py4
-rw-r--r--tests/prefetch_related/tests.py21
-rw-r--r--tests/queries/tests.py33
-rw-r--r--tests/queryset_pickle/tests.py2
-rw-r--r--tests/raw_query/tests.py7
-rw-r--r--tests/requests/tests.py40
-rw-r--r--tests/resolve_url/tests.py31
-rw-r--r--tests/schema/tests.py32
-rw-r--r--tests/select_for_update/tests.py19
-rw-r--r--tests/serializers/models/data.py4
-rw-r--r--tests/serializers/tests.py36
-rw-r--r--tests/servers/tests.py25
-rw-r--r--tests/sessions_tests/tests.py6
-rw-r--r--tests/settings_tests/tests.py4
-rw-r--r--tests/signals/tests.py4
-rw-r--r--tests/sitemaps_tests/test_http.py15
-rw-r--r--tests/sites_tests/tests.py12
-rw-r--r--tests/staticfiles_tests/test_liveserver.py2
-rw-r--r--tests/staticfiles_tests/test_management.py8
-rw-r--r--tests/staticfiles_tests/test_storage.py5
-rw-r--r--tests/string_lookup/tests.py6
-rw-r--r--tests/swappable_models/tests.py4
-rw-r--r--tests/syndication_tests/tests.py23
-rw-r--r--tests/template_backends/test_django.py4
-rw-r--r--tests/template_tests/filter_tests/test_floatformat.py6
-rw-r--r--tests/template_tests/filter_tests/test_join.py3
-rw-r--r--tests/template_tests/filter_tests/test_timesince.py4
-rw-r--r--tests/template_tests/filter_tests/test_timeuntil.py2
-rw-r--r--tests/template_tests/syntax_tests/test_for.py2
-rw-r--r--tests/template_tests/syntax_tests/test_include.py4
-rw-r--r--tests/template_tests/test_context.py2
-rw-r--r--tests/template_tests/test_custom.py11
-rw-r--r--tests/template_tests/test_engine.py4
-rw-r--r--tests/test_client/tests.py40
-rw-r--r--tests/test_client/views.py2
-rw-r--r--tests/test_client_regress/tests.py40
-rw-r--r--tests/test_runner/test_parallel.py2
-rw-r--r--tests/test_runner/tests.py6
-rw-r--r--tests/test_utils/tests.py2
-rw-r--r--tests/update/tests.py10
-rw-r--r--tests/update_only_fields/tests.py2
-rw-r--r--tests/urlpatterns_reverse/tests.py18
-rw-r--r--tests/user_commands/tests.py4
-rw-r--r--tests/utils_tests/test_autoreload.py9
-rw-r--r--tests/utils_tests/test_datetime_safe.py2
-rw-r--r--tests/utils_tests/test_decorators.py8
-rw-r--r--tests/utils_tests/test_encoding.py4
-rw-r--r--tests/utils_tests/test_feedgenerator.py21
-rw-r--r--tests/utils_tests/test_functional.py13
-rw-r--r--tests/utils_tests/test_html.py8
-rw-r--r--tests/utils_tests/test_text.py9
-rw-r--r--tests/validators/tests.py2
-rw-r--r--tests/view_tests/tests/test_csrf.py4
-rw-r--r--tests/view_tests/tests/test_debug.py57
-rw-r--r--tests/view_tests/tests/test_defaults.py3
-rw-r--r--tests/view_tests/tests/test_specials.py5
-rw-r--r--tests/view_tests/tests/test_static.py3
-rw-r--r--tests/view_tests/views.py3
-rw-r--r--tests/wsgi/tests.py5
184 files changed, 1203 insertions, 1528 deletions
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, '<div class="help">Awesome stacked help text is awesome.</div>', 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, '<input type="hidden" name="-1-0-id" id="id_-1-0-id" />', 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, '''<label>Action: <select name="action" required>
@@ -3364,7 +3348,7 @@ action)</option>
self.assertNotContains(response, '<input type="checkbox" class="action-select"')
def test_model_without_action_still_has_jquery(self):
- "Tests that a ModelAdmin without any actions still gets jQuery included in page"
+ "A ModelAdmin without any actions still gets jQuery included in page"
response = self.client.get(reverse('admin:admin_views_oldsubscriber_changelist'))
self.assertIsNone(response.context["action_form"])
self.assertContains(
@@ -3373,14 +3357,14 @@ action)</option>
)
def test_action_column_class(self):
- "Tests that the checkbox column class is present in the response"
+ "The checkbox column class is present in the response"
response = self.client.get(reverse('admin:admin_views_subscriber_changelist'))
self.assertIsNotNone(response.context["action_form"])
self.assertContains(response, 'action-checkbox-column')
def test_multiple_actions_form(self):
"""
- Test that actions come from the form whose submit button was pressed (#10618).
+ Actions come from the form whose submit button was pressed (#10618).
"""
action_data = {
ACTION_CHECKBOX_NAME: [1],
@@ -3501,7 +3485,7 @@ class TestCustomChangeList(TestCase):
self.assertEqual(response.status_code, 302) # redirect somewhere
# Hit the page once to get messages out of the queue message list
response = self.client.get(reverse('admin:admin_views_gadget_changelist'))
- # Ensure that data is still not visible on the page
+ # Data is still not visible on the page
response = self.client.get(reverse('admin:admin_views_gadget_changelist'))
self.assertEqual(response.status_code, 200)
self.assertNotContains(response, 'First Gadget')
@@ -3765,8 +3749,7 @@ class AdminCustomQuerysetTest(TestCase):
def test_history_view_custom_qs(self):
"""
- Ensure that custom querysets are considered for the admin history view.
- Refs #21013.
+ Custom querysets are considered for the admin history view.
"""
self.client.post(reverse('admin:login'), self.super_login)
FilteredManager.objects.create(pk=1)
@@ -3806,7 +3789,7 @@ class AdminInlineFileUploadTest(TestCase):
def test_inline_file_upload_edit_validation_error_post(self):
"""
- Test that inline file uploads correctly display prior data (#10002).
+ Inline file uploads correctly display prior data (#10002).
"""
post_data = {
"name": "Test Gallery",
@@ -3936,7 +3919,7 @@ class AdminInlineTests(TestCase):
self.assertEqual(Widget.objects.all()[0].name, "Widget 1")
widget_id = Widget.objects.all()[0].id
- # Check that the PK link exists on the rendered form
+ # The PK link exists on the rendered form
response = self.client.get(collector_url)
self.assertContains(response, 'name="widget_set-0-id"')
@@ -3968,7 +3951,7 @@ class AdminInlineTests(TestCase):
self.assertEqual(Grommet.objects.count(), 1)
self.assertEqual(Grommet.objects.all()[0].name, "Grommet 1")
- # Check that the PK link exists on the rendered form
+ # The PK link exists on the rendered form
response = self.client.get(collector_url)
self.assertContains(response, 'name="grommet_set-0-code"')
@@ -4001,7 +3984,7 @@ class AdminInlineTests(TestCase):
self.assertEqual(DooHickey.objects.count(), 1)
self.assertEqual(DooHickey.objects.all()[0].name, "Doohickey 1")
- # Check that the PK link exists on the rendered form
+ # The PK link exists on the rendered form
response = self.client.get(collector_url)
self.assertContains(response, 'name="doohickey_set-0-code"')
@@ -4034,7 +4017,7 @@ class AdminInlineTests(TestCase):
self.assertEqual(Whatsit.objects.count(), 1)
self.assertEqual(Whatsit.objects.all()[0].name, "Whatsit 1")
- # Check that the PK link exists on the rendered form
+ # The PK link exists on the rendered form
response = self.client.get(collector_url)
self.assertContains(response, 'name="whatsit_set-0-index"')
@@ -4067,7 +4050,7 @@ class AdminInlineTests(TestCase):
self.assertEqual(FancyDoodad.objects.all()[0].name, "Fancy Doodad 1")
doodad_pk = FancyDoodad.objects.all()[0].pk
- # Check that the PK link exists on the rendered form
+ # The PK link exists on the rendered form
response = self.client.get(collector_url)
self.assertContains(response, 'name="fancydoodad_set-0-doodad_ptr"')
@@ -4090,8 +4073,9 @@ class AdminInlineTests(TestCase):
self.assertEqual(FancyDoodad.objects.all()[0].name, "Fancy Doodad 1 Updated")
def test_ordered_inline(self):
- """Check that an inline with an editable ordering fields is
- updated correctly. Regression for #10922"""
+ """
+ An inline with an editable ordering fields is updated correctly.
+ """
# Create some objects with an initial ordering
Category.objects.create(id=1, order=1, collector=self.collector)
Category.objects.create(id=2, order=2, collector=self.collector)
@@ -4139,7 +4123,7 @@ class AdminInlineTests(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(self.collector.category_set.count(), 4)
self.assertEqual(Category.objects.get(id=1).order, 14)
self.assertEqual(Category.objects.get(id=2).order, 13)
@@ -4269,8 +4253,8 @@ class SeleniumTests(AdminSeleniumTestCase):
def test_prepopulated_fields(self):
"""
- Ensure that the JavaScript-automated prepopulated fields work with the
- main form and with stacked and tabular inlines.
+ The JavaScript-automated prepopulated fields work with the main form
+ and with stacked and tabular inlines.
Refs #13068, #9264, #9983, #9784.
"""
self.admin_login(username='super', password='secret', login_url=reverse('admin:index'))
@@ -4382,9 +4366,8 @@ class SeleniumTests(AdminSeleniumTestCase):
def test_populate_existing_object(self):
"""
- Ensure that the prepopulation works for existing objects too, as long
- as the original field is empty.
- Refs #19082.
+ The prepopulation works for existing objects too, as long as
+ the original field is empty (#19082).
"""
# Slugs are empty to start with.
item = MainPrepopulated.objects.create(
@@ -4422,7 +4405,7 @@ class SeleniumTests(AdminSeleniumTestCase):
def test_collapsible_fieldset(self):
"""
- Test that the 'collapse' class in fieldsets definition allows to
+ The 'collapse' class in fieldsets definition allows to
show/hide the appropriate field section.
"""
self.admin_login(username='super', password='secret', login_url=reverse('admin:index'))
@@ -4614,7 +4597,7 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
self.assertContains(response, "Unknown coolness.")
self.assertContains(response, "foo")
- # Checks that multiline text in a readonly field gets <br /> tags
+ # Multiline text in a readonly field gets <br /> tags
self.assertContains(response, "Multiline<br />test<br />string")
self.assertContains(response, "<p>Multiline<br />html<br />content</p>", html=True)
self.assertContains(response, "InlineMultiline<br />test<br />string")
@@ -5093,8 +5076,7 @@ class CSSTest(TestCase):
@ignore_warnings(category=RemovedInDjango20Warning) # for allow_tags deprecation
def test_field_prefix_css_classes(self):
"""
- Ensure that fields have a CSS class name with a 'field-' prefix.
- Refs #16371.
+ Fields have a CSS class name with a 'field-' prefix.
"""
response = self.client.get(reverse('admin:admin_views_post_add'))
@@ -5113,9 +5095,8 @@ class CSSTest(TestCase):
def test_index_css_classes(self):
"""
- Ensure that CSS class names are used for each app and model on the
- admin index pages.
- Refs #17050.
+ CSS class names are used for each app and model on the admin index
+ pages (#17050).
"""
# General index page
response = self.client.get(reverse('admin:index'))
@@ -5278,8 +5259,8 @@ class DateHierarchyTests(TestCase):
formats.reset_format_cache()
def assert_non_localized_year(self, response, year):
- """Ensure that the year is not localized with
- USE_THOUSAND_SEPARATOR. Refs #15234.
+ """
+ The year is not localized with USE_THOUSAND_SEPARATOR (#15234).
"""
self.assertNotContains(response, formats.number_format(year))
@@ -5299,7 +5280,7 @@ class DateHierarchyTests(TestCase):
def test_empty(self):
"""
- Ensure that no date hierarchy links display with empty changelist.
+ No date hierarchy links display with empty changelist.
"""
response = self.client.get(
reverse('admin:admin_views_podcast_changelist'))
@@ -5309,7 +5290,7 @@ class DateHierarchyTests(TestCase):
def test_single(self):
"""
- Ensure that single day-level date hierarchy appears for single object.
+ Single day-level date hierarchy appears for single object.
"""
DATE = datetime.date(2000, 6, 30)
Podcast.objects.create(release_date=DATE)
@@ -5320,7 +5301,7 @@ class DateHierarchyTests(TestCase):
def test_within_month(self):
"""
- Ensure that day-level links appear for changelist within single month.
+ day-level links appear for changelist within single month.
"""
DATES = (datetime.date(2000, 6, 30),
datetime.date(2000, 6, 15),
@@ -5335,7 +5316,7 @@ class DateHierarchyTests(TestCase):
def test_within_year(self):
"""
- Ensure that month-level links appear for changelist within single year.
+ month-level links appear for changelist within single year.
"""
DATES = (datetime.date(2000, 1, 30),
datetime.date(2000, 3, 15),
@@ -5352,7 +5333,7 @@ class DateHierarchyTests(TestCase):
def test_multiple_years(self):
"""
- Ensure that year-level links appear for year-spanning changelist.
+ year-level links appear for year-spanning changelist.
"""
DATES = (datetime.date(2001, 1, 30),
datetime.date(2003, 3, 15),
@@ -5411,7 +5392,7 @@ class DateHierarchyTests(TestCase):
@override_settings(ROOT_URLCONF='admin_views.urls')
class AdminCustomSaveRelatedTests(TestCase):
"""
- Ensure that one can easily customize the way related objects are saved.
+ One can easily customize the way related objects are saved.
Refs #16115.
"""
@@ -5985,7 +5966,7 @@ class AdminViewOnSiteTests(TestCase):
)
def test_check(self):
- "Ensure that the view_on_site value is either a boolean or a callable"
+ "The view_on_site value is either a boolean or a callable"
try:
admin = CityAdmin(City, AdminSite())
CityAdmin.view_on_site = True
@@ -6007,24 +5988,24 @@ class AdminViewOnSiteTests(TestCase):
CityAdmin.view_on_site = True
def test_false(self):
- "Ensure that the 'View on site' button is not displayed if view_on_site is False"
+ "The 'View on site' button is not displayed if view_on_site is False"
response = self.client.get(reverse('admin:admin_views_restaurant_change', args=(self.r1.pk,)))
content_type_pk = ContentType.objects.get_for_model(Restaurant).pk
self.assertNotContains(response, reverse('admin:view_on_site', args=(content_type_pk, 1)))
def test_true(self):
- "Ensure that the default behavior is followed if view_on_site is True"
+ "The default behavior is followed if view_on_site is True"
response = self.client.get(reverse('admin:admin_views_city_change', args=(self.c1.pk,)))
content_type_pk = ContentType.objects.get_for_model(City).pk
self.assertContains(response, reverse('admin:view_on_site', args=(content_type_pk, self.c1.pk)))
def test_callable(self):
- "Ensure that the right link is displayed if view_on_site is a callable"
+ "The right link is displayed if view_on_site is a callable"
response = self.client.get(reverse('admin:admin_views_worker_change', args=(self.w1.pk,)))
self.assertContains(response, '"/worker/%s/%s/"' % (self.w1.surname, self.w1.name))
def test_missing_get_absolute_url(self):
- "Ensure None is returned if model doesn't have get_absolute_url"
+ "None is returned if model doesn't have get_absolute_url"
model_admin = ModelAdmin(Worker, None)
self.assertIsNone(model_admin.get_view_on_site_url(Worker()))
@@ -6056,26 +6037,26 @@ class InlineAdminViewOnSiteTest(TestCase):
self.client.force_login(self.superuser)
def test_false(self):
- "Ensure that the 'View on site' button is not displayed if view_on_site is False"
+ "The 'View on site' button is not displayed if view_on_site is False"
response = self.client.get(reverse('admin:admin_views_state_change', args=(self.s1.pk,)))
content_type_pk = ContentType.objects.get_for_model(City).pk
self.assertNotContains(response, reverse('admin:view_on_site', args=(content_type_pk, self.c1.pk)))
def test_true(self):
- "Ensure that the 'View on site' button is displayed if view_on_site is True"
+ "The 'View on site' button is displayed if view_on_site is True"
response = self.client.get(reverse('admin:admin_views_city_change', args=(self.c1.pk,)))
content_type_pk = ContentType.objects.get_for_model(Restaurant).pk
self.assertContains(response, reverse('admin:view_on_site', args=(content_type_pk, self.r1.pk)))
def test_callable(self):
- "Ensure that the right link is displayed if view_on_site is a callable"
+ "The right link is displayed if view_on_site is a callable"
response = self.client.get(reverse('admin:admin_views_restaurant_change', args=(self.r1.pk,)))
self.assertContains(response, '"/worker_inline/%s/%s/"' % (self.w1.surname, self.w1.name))
@override_settings(ROOT_URLCONF='admin_views.urls')
class TestETagWithAdminView(SimpleTestCase):
- # See https://code.djangoproject.com/ticket/16003
+ # The admin is compatible with ETags (#16003).
def test_admin(self):
with self.settings(USE_ETAGS=False):
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
index 443e6c6e18..447234209f 100644
--- a/tests/admin_widgets/tests.py
+++ b/tests/admin_widgets/tests.py
@@ -61,16 +61,7 @@ class AdminFormfieldForDBFieldTests(SimpleTestCase):
else:
widget = ff.widget
- # Check that we got a field of the right type
- self.assertTrue(
- isinstance(widget, widgetclass),
- "Wrong widget for %s.%s: expected %s, got %s" % (
- model.__class__.__name__,
- fieldname,
- widgetclass,
- type(widget),
- )
- )
+ self.assertIsInstance(widget, widgetclass)
# Return the formfield so that other tests can continue
return ff
@@ -131,7 +122,7 @@ class AdminFormfieldForDBFieldTests(SimpleTestCase):
def test_formfield_overrides_widget_instances(self):
"""
- Test that widget instances in formfield_overrides are not shared between
+ Widget instances in formfield_overrides are not shared between
different fields. (#19423)
"""
class BandAdmin(admin.ModelAdmin):
@@ -279,10 +270,6 @@ class FilteredSelectMultipleWidgetTest(SimpleTestCase):
class AdminDateWidgetTest(SimpleTestCase):
def test_attrs(self):
- """
- Ensure that user-supplied attrs are used.
- Refs #12073.
- """
w = widgets.AdminDateWidget()
self.assertHTMLEqual(
w.render('test', datetime(2007, 12, 1, 9, 30)),
@@ -298,10 +285,6 @@ class AdminDateWidgetTest(SimpleTestCase):
class AdminTimeWidgetTest(SimpleTestCase):
def test_attrs(self):
- """
- Ensure that user-supplied attrs are used.
- Refs #12073.
- """
w = widgets.AdminTimeWidget()
self.assertHTMLEqual(
w.render('test', datetime(2007, 12, 1, 9, 30)),
@@ -475,8 +458,8 @@ class ForeignKeyRawIdWidgetTest(TestCase):
)
def test_relations_to_non_primary_key(self):
- # Check that ForeignKeyRawIdWidget works with fields which aren't
- # related to the model's primary key.
+ # ForeignKeyRawIdWidget works with fields which aren't related to
+ # the model's primary key.
apple = models.Inventory.objects.create(barcode=86, name='Apple')
models.Inventory.objects.create(barcode=22, name='Pear')
core = models.Inventory.objects.create(
@@ -641,9 +624,7 @@ class DateTimePickerSeleniumTests(AdminWidgetSeleniumTestCase):
def test_show_hide_date_time_picker_widgets(self):
"""
- Ensure that pressing the ESC key closes the date and time picker
- widgets.
- Refs #17064.
+ Pressing the ESC key closes the date and time picker widgets.
"""
from selenium.webdriver.common.keys import Keys
@@ -652,23 +633,23 @@ class DateTimePickerSeleniumTests(AdminWidgetSeleniumTestCase):
self.selenium.get(self.live_server_url + reverse('admin:admin_widgets_member_add'))
# First, with the date picker widget ---------------------------------
- # Check that the date picker is hidden
+ # The date picker is hidden
self.assertEqual(self.get_css_value('#calendarbox0', 'display'), 'none')
# Click the calendar icon
self.selenium.find_element_by_id('calendarlink0').click()
- # Check that the date picker is visible
+ # The date picker is visible
self.assertEqual(self.get_css_value('#calendarbox0', 'display'), 'block')
# Press the ESC key
self.selenium.find_element_by_tag_name('body').send_keys([Keys.ESCAPE])
- # Check that the date picker is hidden again
+ # The date picker is hidden again
self.assertEqual(self.get_css_value('#calendarbox0', 'display'), 'none')
# Then, with the time picker widget ----------------------------------
- # Check that the time picker is hidden
+ # The time picker is hidden
self.assertEqual(self.get_css_value('#clockbox0', 'display'), 'none')
# Click the time icon
self.selenium.find_element_by_id('clocklink0').click()
- # Check that the time picker is visible
+ # The time picker is visible
self.assertEqual(self.get_css_value('#clockbox0', 'display'), 'block')
self.assertEqual(
[
@@ -679,7 +660,7 @@ class DateTimePickerSeleniumTests(AdminWidgetSeleniumTestCase):
)
# Press the ESC key
self.selenium.find_element_by_tag_name('body').send_keys([Keys.ESCAPE])
- # Check that the time picker is hidden again
+ # The time picker is hidden again
self.assertEqual(self.get_css_value('#clockbox0', 'display'), 'none')
def test_calendar_nonday_class(self):
@@ -753,8 +734,8 @@ class DateTimePickerSeleniumTests(AdminWidgetSeleniumTestCase):
def test_calendar_show_date_from_input(self):
"""
- Ensure that the calendar show the date from the input field for every
- locale supported by django.
+ The calendar shows the date from the input field for every locale
+ supported by Django.
"""
self.admin_login(username='super', password='secret', login_url='/')
@@ -795,7 +776,7 @@ class DateTimePickerShortcutsSeleniumTests(AdminWidgetSeleniumTestCase):
def test_date_time_picker_shortcuts(self):
"""
- Ensure that date/time/datetime picker shortcuts work in the current time zone.
+ date/time/datetime picker shortcuts work in the current time zone.
Refs #20663.
This test case is fairly tricky, it relies on selenium still running the browser
@@ -826,7 +807,7 @@ class DateTimePickerShortcutsSeleniumTests(AdminWidgetSeleniumTestCase):
for shortcut in shortcuts:
shortcut.find_element_by_tag_name('a').click()
- # Check that there is a time zone mismatch warning.
+ # There is a time zone mismatch warning.
# Warning: This would effectively fail if the TIME_ZONE defined in the
# settings has the same UTC offset as "Asia/Singapore" because the
# mismatch warning would be rightfully missing from the page.
@@ -1034,8 +1015,8 @@ class HorizontalVerticalFilterSeleniumTests(AdminWidgetSeleniumTestCase):
def test_filter(self):
"""
- Ensure that typing in the search box filters out options displayed in
- the 'from' box.
+ Typing in the search box filters out options displayed in the 'from'
+ box.
"""
from selenium.webdriver.common.keys import Keys
@@ -1076,8 +1057,7 @@ class HorizontalVerticalFilterSeleniumTests(AdminWidgetSeleniumTestCase):
])
# -----------------------------------------------------------------
- # Check that choosing a filtered option sends it properly to the
- # 'to' box.
+ # Choosing a filtered option sends it properly to the 'to' box.
input.send_keys('a')
self.assertSelectOptions(from_box, [str(self.arthur.id), str(self.jason.id)])
self.get_select_option(from_box, str(self.jason.id)).click()
@@ -1101,8 +1081,8 @@ class HorizontalVerticalFilterSeleniumTests(AdminWidgetSeleniumTestCase):
self.assertSelectOptions(to_box, [str(self.peter.id), str(self.jason.id)])
# -----------------------------------------------------------------
- # Check that pressing enter on a filtered option sends it properly
- # to the 'to' box.
+ # Pressing enter on a filtered option sends it properly to
+ # the 'to' box.
self.get_select_option(to_box, str(self.jason.id)).click()
self.selenium.find_element_by_id(remove_link).click()
input.send_keys('ja')
@@ -1137,7 +1117,7 @@ class HorizontalVerticalFilterSeleniumTests(AdminWidgetSeleniumTestCase):
str(self.jason.id), str(self.jenny.id), str(self.john.id),
]
expected_selected_values = [str(self.lisa.id), str(self.peter.id)]
- # Check that everything is still in place
+ # Everything is still in place
self.assertSelectOptions('#id_students_from', expected_unselected_values)
self.assertSelectOptions('#id_students_to', expected_selected_values)
self.assertSelectOptions('#id_alumni_from', expected_unselected_values)
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index 758b101157..81e7e81871 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -816,7 +816,7 @@ class AggregateTestCase(TestCase):
def test_dates_with_aggregation(self):
"""
- Test that .dates() returns a distinct set of dates when applied to a
+ .dates() returns a distinct set of dates when applied to a
QuerySet with aggregation.
Refs #18056. Previously, .dates() would return distinct (date_kind,
@@ -847,8 +847,7 @@ class AggregateTestCase(TestCase):
def test_ticket17424(self):
"""
- Check that doing exclude() on a foreign model after annotate()
- doesn't crash.
+ Doing exclude() on a foreign model after annotate() doesn't crash.
"""
all_books = list(Book.objects.values_list('pk', flat=True).order_by('pk'))
annotated_books = Book.objects.order_by('pk').annotate(one=Count("id"))
@@ -868,7 +867,7 @@ class AggregateTestCase(TestCase):
def test_ticket12886(self):
"""
- Check that aggregation over sliced queryset works correctly.
+ Aggregation over sliced queryset works correctly.
"""
qs = Book.objects.all().order_by('-rating')[0:3]
vals = qs.aggregate(average_top3_rating=Avg('rating'))['average_top3_rating']
@@ -876,8 +875,8 @@ class AggregateTestCase(TestCase):
def test_ticket11881(self):
"""
- Check that subqueries do not needlessly contain ORDER BY, SELECT FOR UPDATE
- or select_related() stuff.
+ Subqueries do not needlessly contain ORDER BY, SELECT FOR UPDATE or
+ select_related() stuff.
"""
qs = Book.objects.all().select_for_update().order_by(
'pk').select_related('publisher').annotate(max_pk=Max('pk'))
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
index 72208b7402..59a40c7176 100644
--- a/tests/aggregation_regress/tests.py
+++ b/tests/aggregation_regress/tests.py
@@ -112,7 +112,7 @@ class AggregationTests(TestCase):
Regression test for #12822: DatabaseError: aggregates not allowed in
WHERE clause
- Tests that the subselect works and returns results equivalent to a
+ The subselect works and returns results equivalent to a
query with the IDs listed.
Before the corresponding fix for this bug, this test passed in 1.1 and
@@ -310,14 +310,14 @@ class AggregationTests(TestCase):
'name': 'The Definitive Guide to Django: Web Development Done Right',
})
- # Check that all of the objects are getting counted (allow_nulls) and
- # that values respects the amount of objects
+ # All of the objects are getting counted (allow_nulls) and that values
+ # respects the amount of objects
self.assertEqual(
len(Author.objects.annotate(Avg('friends__age')).values()),
9
)
- # Check that consecutive calls to annotate accumulate in the query
+ # Consecutive calls to annotate accumulate in the query
qs = (
Book.objects
.values('price')
@@ -676,8 +676,7 @@ class AggregationTests(TestCase):
# Regression for #15709 - Ensure each group_by field only exists once
# per query
qstr = str(Book.objects.values('publisher').annotate(max_pages=Max('pages')).order_by().query)
- # Check that there is just one GROUP BY clause (zero commas means at
- # most one clause)
+ # There is just one GROUP BY clause (zero commas means at most one clause).
self.assertEqual(qstr[qstr.index('GROUP BY'):].count(', '), 0)
def test_duplicate_alias(self):
@@ -930,7 +929,7 @@ class AggregationTests(TestCase):
self.assertEqual(list(qs), list(Book.objects.values_list("pk", flat=True)))
def test_having_group_by(self):
- # Test that when a field occurs on the LHS of a HAVING clause that it
+ # When a field occurs on the LHS of a HAVING clause that it
# appears correctly in the GROUP BY clause
qs = Book.objects.values_list("name").annotate(
n_authors=Count("authors")
@@ -1123,13 +1122,13 @@ class AggregationTests(TestCase):
def test_annotate_joins(self):
"""
- Test that the base table's join isn't promoted to LOUTER. This could
+ The base table's join isn't promoted to LOUTER. This could
cause the query generation to fail if there is an exclude() for fk-field
in the query, too. Refs #19087.
"""
qs = Book.objects.annotate(n=Count('pk'))
self.assertIs(qs.query.alias_map['aggregation_regress_book'].join_type, None)
- # Check that the query executes without problems.
+ # The query executes without problems.
self.assertEqual(len(qs.exclude(publisher=-1)), 6)
@skipUnlessAnyDBFeature('allows_group_by_pk', 'allows_group_by_selected_pks')
@@ -1145,8 +1144,6 @@ class AggregationTests(TestCase):
self.assertIn('id', group_by[0][0])
self.assertNotIn('name', group_by[0][0])
self.assertNotIn('age', group_by[0][0])
-
- # Ensure that we get correct results.
self.assertEqual(
[(a.name, a.num_contacts) for a in results.order_by('name')],
[
@@ -1171,8 +1168,6 @@ class AggregationTests(TestCase):
self.assertIn('id', grouping[0][0])
self.assertNotIn('name', grouping[0][0])
self.assertNotIn('age', grouping[0][0])
-
- # Ensure that we get correct results.
self.assertEqual(
[(a.name, a.num_contacts) for a in results.order_by('name')],
[
@@ -1199,8 +1194,6 @@ class AggregationTests(TestCase):
self.assertIn('id', grouping[0][0])
self.assertNotIn('name', grouping[0][0])
self.assertNotIn('contact', grouping[0][0])
-
- # Ensure that we get correct results.
self.assertEqual(
[(b.name, b.num_authors) for b in results.order_by('name')],
[
@@ -1295,7 +1288,7 @@ class AggregationTests(TestCase):
)
def test_name_expressions(self):
- # Test that aggregates are spotted correctly from F objects.
+ # Aggregates are spotted correctly from F objects.
# Note that Adrian's age is 34 in the fixtures, and he has one book
# so both conditions match one author.
qs = Author.objects.annotate(Count('book')).filter(
@@ -1318,7 +1311,7 @@ class AggregationTests(TestCase):
def test_ticket_11293_q_immutable(self):
"""
- Check that splitting a q object to parts for where/having doesn't alter
+ Splitting a q object to parts for where/having doesn't alter
the original q-object.
"""
q1 = Q(isbn='')
@@ -1329,8 +1322,7 @@ class AggregationTests(TestCase):
def test_fobj_group_by(self):
"""
- Check that an F() object referring to related column works correctly
- in group by.
+ An F() object referring to related column works correctly in group by.
"""
qs = Book.objects.annotate(
account=Count('authors')
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index ad2f071fa4..0515ac1ca1 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -343,7 +343,7 @@ class NonAggregateAnnotationTestCase(TestCase):
def test_null_annotation(self):
"""
- Test that annotating None onto a model round-trips
+ Annotating None onto a model round-trips
"""
book = Book.objects.annotate(no_value=Value(None, output_field=IntegerField())).first()
self.assertIsNone(book.no_value)
@@ -372,9 +372,9 @@ class NonAggregateAnnotationTestCase(TestCase):
def test_column_field_ordering(self):
"""
- Test that columns are aligned in the correct order for
- resolve_columns. This test will fail on mysql if column
- ordering is out. Column fields should be aligned as:
+ Columns are aligned in the correct order for resolve_columns. This test
+ will fail on MySQL if column ordering is out. Column fields should be
+ aligned as:
1. extra_select
2. model_fields
3. annotation_fields
diff --git a/tests/apps/tests.py b/tests/apps/tests.py
index 639ce97758..a0f7ecbb10 100644
--- a/tests/apps/tests.py
+++ b/tests/apps/tests.py
@@ -40,7 +40,7 @@ class AppsTests(SimpleTestCase):
def test_singleton_master(self):
"""
- Ensures that only one master registry can exist.
+ Only one master registry can exist.
"""
with self.assertRaises(RuntimeError):
Apps(installed_apps=None)
@@ -179,7 +179,7 @@ class AppsTests(SimpleTestCase):
def test_models_py(self):
"""
- Tests that the models in the models.py file were loaded correctly.
+ The models in the models.py file were loaded correctly.
"""
self.assertEqual(apps.get_model("apps", "TotallyNormal"), TotallyNormal)
with self.assertRaises(LookupError):
@@ -282,7 +282,7 @@ class AppsTests(SimpleTestCase):
# and LazyModelC shouldn't be waited on until LazyModelB exists.
self.assertSetEqual(set(apps._pending_operations) - initial_pending, {('apps', 'lazyb')})
- # Test that multiple operations can wait on the same model
+ # Multiple operations can wait on the same model
apps.lazy_model_operation(test_func, ('apps', 'lazyb'))
class LazyB(models.Model):
diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py
index ea40992a61..080270296b 100644
--- a/tests/auth_tests/test_auth_backends.py
+++ b/tests/auth_tests/test_auth_backends.py
@@ -295,7 +295,7 @@ class CustomPermissionsUserModelBackendTest(BaseModelBackendTest, TestCase):
@override_settings(AUTH_USER_MODEL='auth_tests.CustomUser')
class CustomUserModelBackendAuthenticateTest(TestCase):
"""
- Tests that the model backend can accept a credentials kwarg labeled with
+ The model backend can accept a credentials kwarg labeled with
custom user model's USERNAME_FIELD.
"""
@@ -440,7 +440,7 @@ class AnonymousUserBackendTest(SimpleTestCase):
@override_settings(AUTHENTICATION_BACKENDS=[])
class NoBackendsTest(TestCase):
"""
- Tests that an appropriate error is raised if no auth backends are provided.
+ An appropriate error is raised if no auth backends are provided.
"""
def setUp(self):
self.user = User.objects.create_user('test', 'test@example.com', 'test')
@@ -487,7 +487,7 @@ class PermissionDeniedBackend(object):
class PermissionDeniedBackendTest(TestCase):
"""
- Tests that other backends are not checked once a backend raises PermissionDenied
+ Other backends are not checked once a backend raises PermissionDenied
"""
backend = 'auth_tests.test_auth_backends.PermissionDeniedBackend'
@@ -547,27 +547,22 @@ class ChangedBackendSettingsTest(TestCase):
TEST_EMAIL = 'test@example.com'
def setUp(self):
- User.objects.create_user(self.TEST_USERNAME,
- self.TEST_EMAIL,
- self.TEST_PASSWORD)
+ User.objects.create_user(self.TEST_USERNAME, self.TEST_EMAIL, self.TEST_PASSWORD)
@override_settings(AUTHENTICATION_BACKENDS=[backend])
def test_changed_backend_settings(self):
"""
- Tests that removing a backend configured in AUTHENTICATION_BACKENDS
- make already logged-in users disconnect.
+ Removing a backend configured in AUTHENTICATION_BACKENDS makes already
+ logged-in users disconnect.
"""
-
# Get a session for the test user
self.assertTrue(self.client.login(
username=self.TEST_USERNAME,
password=self.TEST_PASSWORD)
)
-
# Prepare a request object
request = HttpRequest()
request.session = self.client.session
-
# Remove NewModelBackend
with self.settings(AUTHENTICATION_BACKENDS=[
'django.contrib.auth.backends.ModelBackend']):
@@ -591,9 +586,7 @@ class TypeErrorBackend(object):
class TypeErrorBackendTest(TestCase):
"""
- Tests that a TypeError within a backend is propagated properly.
-
- Regression test for ticket #18171
+ A TypeError within a backend is propagated properly (#18171).
"""
backend = 'auth_tests.test_auth_backends.TypeErrorBackend'
@@ -608,17 +601,12 @@ class TypeErrorBackendTest(TestCase):
class ImproperlyConfiguredUserModelTest(TestCase):
"""
- Tests that an exception from within get_user_model is propagated and doesn't
- raise an UnboundLocalError.
-
- Regression test for ticket #21439
+ An exception from within get_user_model() is propagated and doesn't
+ raise an UnboundLocalError (#21439).
"""
def setUp(self):
self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
- self.client.login(
- username='test',
- password='test'
- )
+ self.client.login(username='test', password='test')
@override_settings(AUTH_USER_MODEL='thismodel.doesntexist')
def test_does_not_shadow_exception(self):
diff --git a/tests/auth_tests/test_basic.py b/tests/auth_tests/test_basic.py
index 0552f877e1..2e18260e4c 100644
--- a/tests/auth_tests/test_basic.py
+++ b/tests/auth_tests/test_basic.py
@@ -16,7 +16,7 @@ from .models import CustomUser
class BasicTestCase(TestCase):
def test_user(self):
- "Check that users can be created and can set their password"
+ "Users can be created and can set their password"
u = User.objects.create_user('testuser', 'test@example.com', 'testpw')
self.assertTrue(u.has_usable_password())
self.assertFalse(u.check_password('bad'))
@@ -77,7 +77,7 @@ class BasicTestCase(TestCase):
self.assertEqual(str(warns[0].message), deprecation_message)
def test_user_no_email(self):
- "Check that users can be created without an email"
+ "Users can be created without an email"
u = User.objects.create_user('testuser1')
self.assertEqual(u.email, '')
diff --git a/tests/auth_tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py
index 150703440b..d9efdc3d5b 100644
--- a/tests/auth_tests/test_context_processors.py
+++ b/tests/auth_tests/test_context_processors.py
@@ -41,7 +41,7 @@ class PermWrapperTests(SimpleTestCase):
def test_permwrapper_in(self):
"""
- Test that 'something' in PermWrapper works as expected.
+ 'something' in PermWrapper works as expected.
"""
perms = PermWrapper(MockUser())
# Works for modules and full permissions.
@@ -72,7 +72,7 @@ class AuthContextProcessorTests(TestCase):
@override_settings(MIDDLEWARE=AUTH_MIDDLEWARE)
def test_session_not_accessed(self):
"""
- Tests that the session is not accessed simply by including
+ The session is not accessed simply by including
the auth context processor
"""
response = self.client.get('/auth_processor_no_attr_access/')
@@ -87,7 +87,7 @@ class AuthContextProcessorTests(TestCase):
@override_settings(MIDDLEWARE=AUTH_MIDDLEWARE)
def test_session_is_accessed(self):
"""
- Tests that the session is accessed if the auth context processor
+ The session is accessed if the auth context processor
is used and relevant attributes accessed.
"""
response = self.client.get('/auth_processor_attr_access/')
@@ -130,7 +130,7 @@ class AuthContextProcessorTests(TestCase):
def test_user_attrs(self):
"""
- Test that the lazy objects returned behave just like the wrapped objects.
+ The lazy objects returned behave just like the wrapped objects.
"""
# These are 'functional' level tests for common use cases. Direct
# testing of the implementation (SimpleLazyObject) is in the 'utils'
diff --git a/tests/auth_tests/test_decorators.py b/tests/auth_tests/test_decorators.py
index 42632049bc..dc3482de22 100644
--- a/tests/auth_tests/test_decorators.py
+++ b/tests/auth_tests/test_decorators.py
@@ -17,7 +17,7 @@ class LoginRequiredTestCase(AuthViewsTestCase):
def testCallable(self):
"""
- Check that login_required is assignable to callable objects.
+ login_required is assignable to callable objects.
"""
class CallableView(object):
def __call__(self, *args, **kwargs):
@@ -26,7 +26,7 @@ class LoginRequiredTestCase(AuthViewsTestCase):
def testView(self):
"""
- Check that login_required is assignable to normal views.
+ login_required is assignable to normal views.
"""
def normal_view(request):
pass
@@ -34,8 +34,8 @@ class LoginRequiredTestCase(AuthViewsTestCase):
def testLoginRequired(self, view_url='/login_required/', login_url=None):
"""
- Check that login_required works on a simple view wrapped in a
- login_required decorator.
+ login_required works on a simple view wrapped in a login_required
+ decorator.
"""
if login_url is None:
login_url = settings.LOGIN_URL
@@ -48,8 +48,8 @@ class LoginRequiredTestCase(AuthViewsTestCase):
def testLoginRequiredNextUrl(self):
"""
- Check that login_required works on a simple view wrapped in a
- login_required decorator with a login_url set.
+ login_required works on a simple view wrapped in a login_required
+ decorator with a login_url set.
"""
self.testLoginRequired(view_url='/login_required_login_url/', login_url='/somewhere/')
diff --git a/tests/auth_tests/test_deprecated_views.py b/tests/auth_tests/test_deprecated_views.py
index 6034fd11de..542833686a 100644
--- a/tests/auth_tests/test_deprecated_views.py
+++ b/tests/auth_tests/test_deprecated_views.py
@@ -195,12 +195,12 @@ class PasswordResetTest(AuthViewsTestCase):
self.assertContains(response, "The password reset link was invalid")
def test_confirm_invalid_user(self):
- # Ensure that we get a 200 response for a non-existent user, not a 404
+ # We get a 200 response for a non-existent user, not a 404
response = self.client.get('/reset/123456/1-1/')
self.assertContains(response, "The password reset link was invalid")
def test_confirm_overflow_user(self):
- # Ensure that we get a 200 response for a base36 user id that overflows int
+ # We get a 200 response for a base36 user id that overflows int
response = self.client.get('/reset/zzzzzzzzzzzzz/1-1/')
self.assertContains(response, "The password reset link was invalid")
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index 8d656bd6f9..cc77288f56 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -745,7 +745,7 @@ class PasswordResetFormTest(TestDataMixin, TestCase):
def test_inactive_user(self):
"""
- Test that inactive user cannot receive password reset email.
+ Inactive user cannot receive password reset email.
"""
(user, username, email) = self.create_dummy_user()
user.is_active = False
diff --git a/tests/auth_tests/test_handlers.py b/tests/auth_tests/test_handlers.py
index 0acf9377cb..0e2a42b80a 100644
--- a/tests/auth_tests/test_handlers.py
+++ b/tests/auth_tests/test_handlers.py
@@ -24,7 +24,7 @@ class ModWsgiHandlerTestCase(TransactionTestCase):
def test_check_password(self):
"""
- Verify that check_password returns the correct values as per
+ check_password() returns the correct values as per
https://modwsgi.readthedocs.io/en/develop/user-guides/access-control-mechanisms.html#apache-authentication-provider
"""
User.objects.create_user('test', 'test@example.com', 'test')
@@ -45,11 +45,10 @@ class ModWsgiHandlerTestCase(TransactionTestCase):
@override_settings(AUTH_USER_MODEL='auth_tests.CustomUser')
def test_check_password_custom_user(self):
"""
- Verify that check_password returns the correct values as per
+ check_password() returns the correct values as per
https://modwsgi.readthedocs.io/en/develop/user-guides/access-control-mechanisms.html#apache-authentication-provider
- with custom user installed
+ with a custom user installed.
"""
-
CustomUser._default_manager.create_user('test@example.com', '1990-01-01', 'test')
# User not in database
@@ -63,7 +62,7 @@ class ModWsgiHandlerTestCase(TransactionTestCase):
def test_groups_for_user(self):
"""
- Check that groups_for_user returns correct values as per
+ groups_for_user() returns correct values as per
https://modwsgi.readthedocs.io/en/develop/user-guides/access-control-mechanisms.html#apache-group-authorisation
"""
user1 = User.objects.create_user('test', 'test@example.com', 'test')
diff --git a/tests/auth_tests/test_hashers.py b/tests/auth_tests/test_hashers.py
index 69d6f555a8..69ca1a141f 100644
--- a/tests/auth_tests/test_hashers.py
+++ b/tests/auth_tests/test_hashers.py
@@ -161,7 +161,7 @@ class TestUtilsHashPass(SimpleTestCase):
self.assertFalse(check_password('lètmeinz', encoded))
self.assertEqual(identify_hasher(encoded).algorithm, "bcrypt_sha256")
- # Verify that password truncation no longer works
+ # password truncation no longer works
password = (
'VSK0UYV6FFQVZ0KG88DYN9WADAADZO1CTSIVDJUNZSUML6IBX7LN7ZS3R5'
'JGB3RGZ7VI7G7DJQ9NI8BQFSRPTG6UWTTVESA5ZPUN'
@@ -210,7 +210,7 @@ class TestUtilsHashPass(SimpleTestCase):
def setter(password):
state['upgraded'] = True
- # Check that no upgrade is triggered.
+ # No upgrade is triggered.
self.assertTrue(check_password('letmein', encoded, setter, 'bcrypt'))
self.assertFalse(state['upgraded'])
@@ -353,7 +353,7 @@ class TestUtilsHashPass(SimpleTestCase):
def setter(password):
state['upgraded'] = True
- # Check that no upgrade is triggered
+ # No upgrade is triggered
self.assertTrue(check_password('letmein', encoded, setter))
self.assertFalse(state['upgraded'])
@@ -401,7 +401,7 @@ class TestUtilsHashPass(SimpleTestCase):
algo, iterations, salt, hash = encoded.split('$', 3)
self.assertEqual(iterations, '1')
- # Check that no upgrade is triggered
+ # No upgrade is triggered
self.assertTrue(check_password('letmein', encoded, setter))
self.assertFalse(state['upgraded'])
@@ -513,7 +513,7 @@ class TestUtilsHashPassArgon2(SimpleTestCase):
def setter(password):
state['upgraded'] = True
- # Check that no upgrade is triggered.
+ # No upgrade is triggered.
self.assertTrue(check_password('letmein', encoded, setter, 'argon2'))
self.assertFalse(state['upgraded'])
diff --git a/tests/auth_tests/test_mixins.py b/tests/auth_tests/test_mixins.py
index 5df5ee3c4e..4f74890304 100644
--- a/tests/auth_tests/test_mixins.py
+++ b/tests/auth_tests/test_mixins.py
@@ -186,8 +186,8 @@ class LoginRequiredMixinTests(TestCase):
def test_login_required(self):
"""
- Check that login_required works on a simple view wrapped in a
- login_required decorator.
+ login_required works on a simple view wrapped in a login_required
+ decorator.
"""
class AView(LoginRequiredMixin, EmptyResponseView):
pass
diff --git a/tests/auth_tests/test_models.py b/tests/auth_tests/test_models.py
index c939f3437c..bd64949501 100644
--- a/tests/auth_tests/test_models.py
+++ b/tests/auth_tests/test_models.py
@@ -189,9 +189,7 @@ class AbstractUserTestCase(TestCase):
from_email="from@domain.com",
**kwargs
)
- # Test that one message has been sent.
self.assertEqual(len(mail.outbox), 1)
- # Verify that test email contains the correct attributes:
message = mail.outbox[0]
self.assertEqual(message.subject, "Subject here")
self.assertEqual(message.body, "This is a message")
diff --git a/tests/auth_tests/test_remote_user.py b/tests/auth_tests/test_remote_user.py
index 2b5bf32d74..05c76ff6e3 100644
--- a/tests/auth_tests/test_remote_user.py
+++ b/tests/auth_tests/test_remote_user.py
@@ -77,7 +77,7 @@ class RemoteUserTest(TestCase):
**{self.header: self.known_user})
self.assertEqual(response.context['user'].username, 'knownuser')
self.assertEqual(User.objects.count(), num_users)
- # Test that a different user passed in the headers causes the new user
+ # A different user passed in the headers causes the new user
# to be logged in.
response = self.client.get('/remote_user/',
**{self.header: self.known_user2})
@@ -86,7 +86,7 @@ class RemoteUserTest(TestCase):
def test_last_login(self):
"""
- Tests that a user's last_login is set the first time they make a
+ A user's last_login is set the first time they make a
request but not updated in subsequent requests with the same session.
"""
user = User.objects.create(username='knownuser')
@@ -110,7 +110,7 @@ class RemoteUserTest(TestCase):
def test_header_disappears(self):
"""
- Tests that a logged in user is logged out automatically when
+ A logged in user is logged out automatically when
the REMOTE_USER header disappears during the same browser session.
"""
User.objects.create(username='knownuser')
@@ -131,7 +131,7 @@ class RemoteUserTest(TestCase):
def test_user_switch_forces_new_login(self):
"""
- Tests that if the username in the header changes between requests
+ If the username in the header changes between requests
that the original user is logged out
"""
User.objects.create(username='knownuser')
@@ -142,7 +142,7 @@ class RemoteUserTest(TestCase):
# During the session, the REMOTE_USER changes to a different user.
response = self.client.get('/remote_user/',
**{self.header: "newnewuser"})
- # Ensure that the current user is not the prior remote_user
+ # The current user is not the prior remote_user.
# In backends that create a new user, username is "newnewuser"
# In backends that do not create new users, it is '' (anonymous user)
self.assertNotEqual(response.context['user'].username, 'knownuser')
diff --git a/tests/auth_tests/test_signals.py b/tests/auth_tests/test_signals.py
index c21daa3c1d..8fb2046e1c 100644
--- a/tests/auth_tests/test_signals.py
+++ b/tests/auth_tests/test_signals.py
@@ -68,7 +68,7 @@ class SignalTestCase(TestCase):
self.assertEqual(self.logged_out[0].username, 'testclient')
def test_update_last_login(self):
- """Ensure that only `last_login` is updated in `update_last_login`"""
+ """Only `last_login` is updated in `update_last_login`"""
user = self.u3
old_last_login = user.last_login
diff --git a/tests/auth_tests/test_tokens.py b/tests/auth_tests/test_tokens.py
index bddcd323d7..99f9741a0a 100644
--- a/tests/auth_tests/test_tokens.py
+++ b/tests/auth_tests/test_tokens.py
@@ -11,9 +11,6 @@ from django.utils.six import PY3
class TokenGeneratorTest(TestCase):
def test_make_token(self):
- """
- Ensure that we can make a token and that it is valid
- """
user = User.objects.create_user('tokentestuser', 'test2@example.com', 'testpw')
p0 = PasswordResetTokenGenerator()
tk1 = p0.make_token(user)
@@ -21,7 +18,7 @@ class TokenGeneratorTest(TestCase):
def test_10265(self):
"""
- Ensure that the token generated for a user created in the same request
+ The token generated for a user created in the same request
will work correctly.
"""
# See ticket #10265
@@ -34,7 +31,7 @@ class TokenGeneratorTest(TestCase):
def test_timeout(self):
"""
- Ensure we can use the token after n days, but no greater.
+ The token is valid after n days, but no greater.
"""
# Uses a mocked version of PasswordResetTokenGenerator so we can change
# the value of 'today'
@@ -57,7 +54,7 @@ class TokenGeneratorTest(TestCase):
@unittest.skipIf(PY3, "Unnecessary test with Python 3")
def test_date_length(self):
"""
- Make sure we don't allow overly long dates, causing a potential DoS.
+ Overly long dates, which are a potential DoS vector, aren't allowed.
"""
user = User.objects.create_user('ima1337h4x0r', 'test4@example.com', 'p4ssw0rd')
p0 = PasswordResetTokenGenerator()
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py
index d1235c45d7..77d1ada13b 100644
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -233,18 +233,17 @@ class PasswordResetTest(AuthViewsTestCase):
self.assertContains(response, "The password reset link was invalid")
def test_confirm_invalid_user(self):
- # Ensure that we get a 200 response for a non-existent user, not a 404
+ # A non-existent user returns a 200 response, not a 404.
response = self.client.get('/reset/123456/1-1/')
self.assertContains(response, "The password reset link was invalid")
def test_confirm_overflow_user(self):
- # Ensure that we get a 200 response for a base36 user id that overflows int
+ # A base36 user id that overflows int returns a 200 response.
response = self.client.get('/reset/zzzzzzzzzzzzz/1-1/')
self.assertContains(response, "The password reset link was invalid")
def test_confirm_invalid_post(self):
- # Same as test_confirm_invalid, but trying
- # to do a POST instead.
+ # Same as test_confirm_invalid, but trying to do a POST instead.
url, path = self._test_confirm_start()
path = path[:-5] + ("0" * 4) + path[-1]
@@ -311,14 +310,12 @@ class PasswordResetTest(AuthViewsTestCase):
def test_confirm_display_user_from_form(self):
url, path = self._test_confirm_start()
response = self.client.get(path)
-
- # #16919 -- The ``password_reset_confirm`` view should pass the user
- # object to the ``SetPasswordForm``, even on GET requests.
- # For this test, we render ``{{ form.user }}`` in the template
- # ``registration/password_reset_confirm.html`` so that we can test this.
+ # The password_reset_confirm() view passes the user object to the
+ # SetPasswordForm``, even on GET requests (#16919). For this test,
+ # {{ form.user }}`` is rendered in the template
+ # registration/password_reset_confirm.html.
username = User.objects.get(email='staffmember@example.com').username
self.assertContains(response, "Hello, %s." % username)
-
# However, the view should NOT pass any user object on a form if the
# password reset link was invalid.
response = self.client.get('/reset/zzzzzzzzzzzzz/1-1/')
@@ -978,7 +975,7 @@ class LogoutTest(AuthViewsTestCase):
self.confirm_logged_out()
def test_logout_preserve_language(self):
- """Check that language stored in session is preserved after logout"""
+ """Language stored in session is preserved after logout"""
# Create a new session with language
engine = import_module(settings.SESSION_ENGINE)
session = engine.SessionStore()
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 106fd7f856..f2bb1b8998 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -61,7 +61,7 @@ class DummyBackendTest(SimpleTestCase):
def test_no_databases(self):
"""
- Test that empty DATABASES setting default to the dummy backend.
+ Empty DATABASES setting default to the dummy backend.
"""
DATABASES = {}
conns = ConnectionHandler(DATABASES)
@@ -74,7 +74,7 @@ class DummyBackendTest(SimpleTestCase):
class OracleTests(unittest.TestCase):
def test_quote_name(self):
- # Check that '%' chars are escaped for query execution.
+ # '%' chars are escaped for query execution.
name = '"SOME%NAME"'
quoted_name = connection.ops.quote_name(name)
self.assertEqual(quoted_name % (), name)
@@ -122,7 +122,7 @@ class OracleTests(unittest.TestCase):
# NLS parameters as per #18465.
with connection.cursor() as cursor:
query = "select 1 from dual where '1936-12-29 00:00' < sysdate"
- # Test that the query succeeds without errors - pre #18465 this
+ # The query succeeds without errors - pre #18465 this
# wasn't the case.
cursor.execute(query)
self.assertEqual(cursor.fetchone()[0], 1)
@@ -135,8 +135,8 @@ class SQLiteTests(TestCase):
def test_autoincrement(self):
"""
- Check that auto_increment fields are created with the AUTOINCREMENT
- keyword in order to be monotonically increasing. Refs #10164.
+ auto_increment fields are created with the AUTOINCREMENT keyword
+ in order to be monotonically increasing. Refs #10164.
"""
with connection.schema_editor(collect_sql=True) as editor:
editor.create_model(models.Square)
@@ -211,7 +211,7 @@ class PostgreSQLTests(TestCase):
def test_nodb_connection(self):
"""
- Test that the _nodb_connection property fallbacks to the default connection
+ The _nodb_connection property fallbacks to the default connection
database when access to the 'postgres' database is not granted.
"""
def mocked_connect(self):
@@ -378,10 +378,7 @@ class DateQuotingTest(TestCase):
def test_django_date_trunc(self):
"""
Test the custom ``django_date_trunc method``, in particular against
- fields which clash with strings passed to it (e.g. 'year') - see
- #12818__.
-
- __: http://code.djangoproject.com/ticket/12818
+ fields which clash with strings passed to it (e.g. 'year') (#12818).
"""
updated = datetime.datetime(2010, 2, 20)
models.SchoolClass.objects.create(year=2009, last_updated=updated)
@@ -391,9 +388,7 @@ class DateQuotingTest(TestCase):
def test_django_date_extract(self):
"""
Test the custom ``django_date_extract method``, in particular against fields
- which clash with strings passed to it (e.g. 'day') - see #12818__.
-
- __: http://code.djangoproject.com/ticket/12818
+ which clash with strings passed to it (e.g. 'day') (#12818).
"""
updated = datetime.datetime(2010, 2, 20)
models.SchoolClass.objects.create(year=2009, last_updated=updated)
@@ -420,7 +415,7 @@ class LastExecutedQueryTest(TestCase):
def test_query_encoding(self):
"""
- Test that last_executed_query() returns an Unicode string
+ last_executed_query() returns an Unicode string
"""
data = models.RawData.objects.filter(raw_data=b'\x00\x46 \xFE').extra(select={'föö': 1})
sql, params = data.query.sql_with_params()
@@ -431,8 +426,7 @@ class LastExecutedQueryTest(TestCase):
@unittest.skipUnless(connection.vendor == 'sqlite',
"This test is specific to SQLite.")
def test_no_interpolation_on_sqlite(self):
- # Regression for #17158
- # This shouldn't raise an exception
+ # This shouldn't raise an exception (##17158)
query = "SELECT strftime('%Y', 'now');"
connection.cursor().execute(query)
self.assertEqual(connection.queries[-1]['sql'], query)
@@ -729,7 +723,7 @@ class BackendTestCase(TransactionTestCase):
def test_database_operations_init(self):
"""
- Test that DatabaseOperations initialization doesn't query the database.
+ DatabaseOperations initialization doesn't query the database.
See #17656.
"""
with self.assertNumQueries(0):
@@ -741,7 +735,7 @@ class BackendTestCase(TransactionTestCase):
self.assertIn(connection.features.can_introspect_foreign_keys, (True, False))
def test_duplicate_table_error(self):
- """ Test that creating an existing table returns a DatabaseError """
+ """ Creating an existing table returns a DatabaseError """
cursor = connection.cursor()
query = 'CREATE TABLE %s (id INTEGER);' % models.Article._meta.db_table
with self.assertRaises(DatabaseError):
@@ -749,7 +743,7 @@ class BackendTestCase(TransactionTestCase):
def test_cursor_contextmanager(self):
"""
- Test that cursors can be used as a context manager
+ Cursors can be used as a context manager
"""
with connection.cursor() as cursor:
self.assertIsInstance(cursor, CursorWrapper)
@@ -774,9 +768,7 @@ class BackendTestCase(TransactionTestCase):
@skipUnlessDBFeature('test_db_allows_multiple_connections')
def test_is_usable_after_database_disconnects(self):
"""
- Test that is_usable() doesn't crash when the database disconnects.
-
- Regression for #21553.
+ is_usable() doesn't crash when the database disconnects (#21553).
"""
# Open a connection to the database.
with connection.cursor():
@@ -816,9 +808,7 @@ class BackendTestCase(TransactionTestCase):
@override_settings(DEBUG=True)
def test_queries_limit(self):
"""
- Test that the backend doesn't store an unlimited number of queries.
-
- Regression for #12581.
+ The backend doesn't store an unlimited number of queries (#12581).
"""
old_queries_limit = BaseDatabaseWrapper.queries_limit
BaseDatabaseWrapper.queries_limit = 3
@@ -995,9 +985,8 @@ class ThreadTests(TransactionTestCase):
def test_default_connection_thread_local(self):
"""
- Ensure that the default connection (i.e. django.db.connection) is
- different for each thread.
- Refs #17258.
+ The default connection (i.e. django.db.connection) is different for
+ each thread (#17258).
"""
# Map connections by id because connections with identical aliases
# have the same hash.
@@ -1019,7 +1008,7 @@ class ThreadTests(TransactionTestCase):
t = threading.Thread(target=runner)
t.start()
t.join()
- # Check that each created connection got different inner connection.
+ # Each created connection got different inner connection.
self.assertEqual(
len(set(conn.connection for conn in connections_dict.values())),
3)
@@ -1032,8 +1021,7 @@ class ThreadTests(TransactionTestCase):
def test_connections_thread_local(self):
"""
- Ensure that the connections are different for each thread.
- Refs #17258.
+ The connections are different for each thread (#17258).
"""
# Map connections by id because connections with identical aliases
# have the same hash.
@@ -1062,8 +1050,7 @@ class ThreadTests(TransactionTestCase):
def test_pass_connection_between_threads(self):
"""
- Ensure that a connection can be passed from one thread to the other.
- Refs #17258.
+ A connection can be passed from one thread to the other (#17258).
"""
models.Person.objects.create(first_name="John", last_name="Doe")
@@ -1101,9 +1088,8 @@ class ThreadTests(TransactionTestCase):
def test_closing_non_shared_connections(self):
"""
- Ensure that a connection that is not explicitly shareable cannot be
- closed by another thread.
- Refs #17258.
+ A connection that is not explicitly shareable cannot be closed by
+ another thread (#17258).
"""
# First, without explicitly enabling the connection for sharing.
exceptions = set()
diff --git a/tests/basic/tests.py b/tests/basic/tests.py
index 16c9dd9dae..b4acd1ff45 100644
--- a/tests/basic/tests.py
+++ b/tests/basic/tests.py
@@ -331,7 +331,7 @@ class ModelTest(TestCase):
def test_create_relation_with_ugettext_lazy(self):
"""
- Test that ugettext_lazy objects work when saving model instances
+ ugettext_lazy objects work when saving model instances
through various methods. Refs #10498.
"""
notlazy = 'test'
@@ -640,9 +640,8 @@ class SelectOnSaveTests(TestCase):
def test_select_on_save_lying_update(self):
"""
- Test that select_on_save works correctly if the database
- doesn't return correct information about matched rows from
- UPDATE.
+ select_on_save works correctly if the database doesn't return correct
+ information about matched rows from UPDATE.
"""
# Change the manager to not return "row matched" for update().
# We are going to change the Article's _base_manager class
diff --git a/tests/builtin_server/tests.py b/tests/builtin_server/tests.py
index e1f3e5d71d..e7ba4272b8 100644
--- a/tests/builtin_server/tests.py
+++ b/tests/builtin_server/tests.py
@@ -7,8 +7,7 @@ from unittest import TestCase
from wsgiref import simple_server
# If data is too large, socket will choke, so write chunks no larger than 32MB
-# at a time. The rationale behind the 32MB can be found on Django's Trac:
-# https://code.djangoproject.com/ticket/5596#comment:4
+# at a time. The rationale behind the 32MB can be found in #5596#comment:4.
MAX_SOCKET_CHUNK_SIZE = 32 * 1024 * 1024 # 32 MB
@@ -80,7 +79,7 @@ def wsgi_app_file_wrapper(environ, start_response):
class WSGIFileWrapperTests(TestCase):
"""
- Test that the wsgi.file_wrapper works for the builting server.
+ The wsgi.file_wrapper works for the builting server.
Tests for #9659: wsgi.file_wrapper in the builtin server.
We need to mock a couple of handlers and keep track of what
@@ -134,7 +133,7 @@ def send_big_data_app(environ, start_response):
class ServerHandlerChunksProperly(TestCase):
"""
- Test that the ServerHandler chunks data properly.
+ The ServerHandler chunks data properly.
Tests for #18972: The logic that performs the math to break data into
32MB (MAX_SOCKET_CHUNK_SIZE) chunks was flawed, BUT it didn't actually
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 832727d53c..edf25cfc65 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -506,11 +506,11 @@ class BaseCacheTests(object):
self.assertIsNone(cache.get("key2"))
def test_long_timeout(self):
- '''
- Using a timeout greater than 30 days makes memcached think
- it is an absolute expiration timestamp instead of a relative
- offset. Test that we honour this convention. Refs #12399.
- '''
+ """
+ Followe memcached's convention where a timeout greater than 30 days is
+ treated as an absolute expiration timestamp instead of a relative
+ offset (#12399).
+ """
cache.set('key1', 'eggs', 60 * 60 * 24 * 30 + 1) # 30 days + 1 second
self.assertEqual(cache.get('key1'), 'eggs')
@@ -522,9 +522,9 @@ class BaseCacheTests(object):
self.assertEqual(cache.get('key4'), 'lobster bisque')
def test_forever_timeout(self):
- '''
+ """
Passing in None into timeout results in a value that is cached forever
- '''
+ """
cache.set('key1', 'eggs', None)
self.assertEqual(cache.get('key1'), 'eggs')
@@ -539,9 +539,9 @@ class BaseCacheTests(object):
self.assertEqual(cache.get('key4'), 'lobster bisque')
def test_zero_timeout(self):
- '''
+ """
Passing in zero into timeout results in a value that is not cached
- '''
+ """
cache.set('key1', 'eggs', 0)
self.assertIsNone(cache.get('key1'))
@@ -1115,7 +1115,7 @@ class LocMemCacheTests(BaseCacheTests, TestCase):
},
})
def test_multiple_caches(self):
- "Check that multiple locmem caches are isolated"
+ "Multiple locmem caches are isolated"
cache.set('value', 42)
self.assertEqual(caches['default'].get('value'), 42)
self.assertIsNone(caches['other'].get('value'))
@@ -1432,10 +1432,9 @@ NEVER_EXPIRING_CACHES_SETTINGS['default']['TIMEOUT'] = None
class DefaultNonExpiringCacheKeyTests(SimpleTestCase):
- """Tests that verify that settings having Cache arguments with a TIMEOUT
- set to `None` will create Caches that will set non-expiring keys.
-
- This fixes ticket #22085.
+ """
+ Settings having Cache arguments with a TIMEOUT=None create Caches that will
+ set non-expiring keys.
"""
def setUp(self):
# The 5 minute (300 seconds) default expiration time for keys is
@@ -1449,8 +1448,8 @@ class DefaultNonExpiringCacheKeyTests(SimpleTestCase):
def test_default_expiration_time_for_keys_is_5_minutes(self):
"""The default expiration time of a cache key is 5 minutes.
- This value is defined inside the __init__() method of the
- :class:`django.core.cache.backends.base.BaseCache` type.
+ This value is defined in
+ django.core.cache.backends.base.BaseCache.__init__().
"""
self.assertEqual(300, self.DEFAULT_TIMEOUT)
@@ -1563,7 +1562,7 @@ class CacheUtils(SimpleTestCase):
'views.decorators.cache.cache_page.settingsprefix.GET.'
'18a03f9c9649f7d684af5db3524f5c99.d41d8cd98f00b204e9800998ecf8427e'
)
- # Verify that a specified key_prefix is taken into account.
+ # A specified key_prefix is taken into account.
key_prefix = 'localprefix'
learn_cache_key(request, response, key_prefix=key_prefix)
self.assertEqual(
@@ -1579,8 +1578,7 @@ class CacheUtils(SimpleTestCase):
self.assertIsNone(get_cache_key(request))
# Set headers to an empty list.
learn_cache_key(request, response)
- # Verify that the querystring is taken into account.
-
+ # The querystring is taken into account.
self.assertEqual(
get_cache_key(request),
'views.decorators.cache.cache_page.settingsprefix.GET.'
@@ -1898,12 +1896,12 @@ class CacheI18nTest(TestCase):
request._cache_update_cache = True
set_cache(request, 'en', en_message)
get_cache_data = FetchFromCacheMiddleware().process_request(request)
- # Check that we can recover the cache
+ # The cache can be recovered
self.assertIsNotNone(get_cache_data)
self.assertEqual(get_cache_data.content, en_message.encode())
- # Check that we use etags
+ # ETags are used.
self.assertTrue(get_cache_data.has_header('ETag'))
- # Check that we can disable etags
+ # ETags can be disabled.
with self.settings(USE_ETAGS=False):
request._cache_update_cache = True
set_cache(request, 'en', en_message)
@@ -2229,7 +2227,7 @@ class TestWithTemplateResponse(SimpleTestCase):
'views.decorators.cache.cache_page.settingsprefix.GET.'
'58a0a05c8a5620f813686ff969c26853.d41d8cd98f00b204e9800998ecf8427e'
)
- # Verify that a specified key_prefix is taken into account.
+ # A specified key_prefix is taken into account.
learn_cache_key(request, response, key_prefix=key_prefix)
self.assertEqual(
get_cache_key(request, key_prefix=key_prefix),
@@ -2245,7 +2243,7 @@ class TestWithTemplateResponse(SimpleTestCase):
self.assertIsNone(get_cache_key(request))
# Set headers to an empty list.
learn_cache_key(request, response)
- # Verify that the querystring is taken into account.
+ # The querystring is taken into account.
self.assertEqual(
get_cache_key(request),
'views.decorators.cache.cache_page.settingsprefix.GET.'
diff --git a/tests/contenttypes_tests/test_models.py b/tests/contenttypes_tests/test_models.py
index 18795f9633..cf0c188fa8 100644
--- a/tests/contenttypes_tests/test_models.py
+++ b/tests/contenttypes_tests/test_models.py
@@ -166,11 +166,10 @@ class ContentTypesTests(TestCase):
@override_settings(ALLOWED_HOSTS=['example.com'])
def test_shortcut_view(self):
"""
- Check that the shortcut view (used for the admin "view on site"
- functionality) returns a complete URL regardless of whether the sites
- framework is installed
+ The shortcut view (used for the admin "view on site" functionality)
+ returns a complete URL regardless of whether the sites framework is
+ installed.
"""
-
request = HttpRequest()
request.META = {
"SERVER_NAME": "Example.com",
@@ -192,10 +191,9 @@ class ContentTypesTests(TestCase):
def test_shortcut_view_without_get_absolute_url(self):
"""
- Check that the shortcut view (used for the admin "view on site"
- functionality) returns 404 when get_absolute_url is not defined.
+ The shortcut view (used for the admin "view on site" functionality)
+ returns 404 when get_absolute_url is not defined.
"""
-
request = HttpRequest()
request.META = {
"SERVER_NAME": "Example.com",
@@ -209,9 +207,8 @@ class ContentTypesTests(TestCase):
def test_shortcut_view_with_broken_get_absolute_url(self):
"""
- Check that the shortcut view does not catch an AttributeError raised
- by the model's get_absolute_url method.
- Refs #8997.
+ The shortcut view does not catch an AttributeError raised by
+ the model's get_absolute_url() method (#8997).
"""
request = HttpRequest()
request.META = {
@@ -226,9 +223,9 @@ class ContentTypesTests(TestCase):
def test_missing_model(self):
"""
- Ensures that displaying content types in admin (or anywhere) doesn't
- break on leftover content type records in the DB for which no model
- is defined anymore.
+ Displaying content types in admin (or anywhere) doesn't break on
+ leftover content type records in the DB for which no model is defined
+ anymore.
"""
ct = ContentType.objects.create(
app_label='contenttypes',
diff --git a/tests/contenttypes_tests/tests.py b/tests/contenttypes_tests/tests.py
index ef13d3f4bb..5845c02af6 100644
--- a/tests/contenttypes_tests/tests.py
+++ b/tests/contenttypes_tests/tests.py
@@ -466,8 +466,8 @@ class ContentTypesMultidbTestCase(TestCase):
def test_multidb(self):
"""
- Test that, when using multiple databases, we use the db_for_read (see
- #20401).
+ When using multiple databases, ContentType.objects.get_for_model() uses
+ db_for_read().
"""
ContentType.objects.clear_cache()
diff --git a/tests/context_processors/tests.py b/tests/context_processors/tests.py
index f9c461cad9..635a81f7f9 100644
--- a/tests/context_processors/tests.py
+++ b/tests/context_processors/tests.py
@@ -23,7 +23,7 @@ class RequestContextProcessorTests(SimpleTestCase):
def test_request_attributes(self):
"""
- Test that the request object is available in the template and that its
+ The request object is available in the template and that its
attributes can't be overridden by GET and POST parameters (#3828).
"""
url = '/request_attrs/'
diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py
index 6debb386be..cd7ea8fbc6 100644
--- a/tests/csrf_tests/tests.py
+++ b/tests/csrf_tests/tests.py
@@ -180,7 +180,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_process_response_get_token_not_used(self):
"""
- Check that if get_token() is not called, the view middleware does not
+ If get_token() is not called, the view middleware does not
add a cookie.
"""
# This is important to make pages cacheable. Pages which do call
@@ -201,8 +201,8 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
# Check the request processing
def test_process_request_no_csrf_cookie(self):
"""
- Check that if no CSRF cookies is present, the middleware rejects the
- incoming request. This will stop login CSRF.
+ If no CSRF cookies is present, the middleware rejects the incoming
+ request. This will stop login CSRF.
"""
with patch_logger('django.security.csrf', 'warning') as logger_calls:
req = self._get_POST_no_csrf_cookie_request()
@@ -212,8 +212,8 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_process_request_csrf_cookie_no_token(self):
"""
- Check that if a CSRF cookie is present but no token, the middleware
- rejects the incoming request.
+ If a CSRF cookie is present but no token, the middleware rejects
+ the incoming request.
"""
with patch_logger('django.security.csrf', 'warning') as logger_calls:
req = self._get_POST_csrf_cookie_request()
@@ -223,7 +223,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_process_request_csrf_cookie_and_token(self):
"""
- Check that if both a cookie and a token is present, the middleware lets it through.
+ If both a cookie and a token is present, the middleware lets it through.
"""
req = self._get_POST_request_with_token()
req2 = CsrfViewMiddleware().process_view(req, post_form_view, (), {})
@@ -231,8 +231,8 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_process_request_csrf_cookie_no_token_exempt_view(self):
"""
- Check that if a CSRF cookie is present and no token, but the csrf_exempt
- decorator has been applied to the view, the middleware lets it through
+ If a CSRF cookie is present and no token, but the csrf_exempt decorator
+ has been applied to the view, the middleware lets it through
"""
req = self._get_POST_csrf_cookie_request()
req2 = CsrfViewMiddleware().process_view(req, csrf_exempt(post_form_view), (), {})
@@ -240,7 +240,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_csrf_token_in_header(self):
"""
- Check that we can pass in the token in a header instead of in the form
+ The token may be passed in a header instead of in the form.
"""
req = self._get_POST_csrf_cookie_request()
req.META['HTTP_X_CSRFTOKEN'] = self._csrf_id
@@ -259,7 +259,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_put_and_delete_rejected(self):
"""
- Tests that HTTP PUT and DELETE methods have protection
+ HTTP PUT and DELETE methods have protection
"""
req = TestingHttpRequest()
req.method = 'PUT'
@@ -277,8 +277,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_put_and_delete_allowed(self):
"""
- Tests that HTTP PUT and DELETE methods can get through with
- X-CSRFToken and a cookie
+ HTTP PUT and DELETE can get through with X-CSRFToken and a cookie.
"""
req = self._get_GET_csrf_cookie_request()
req.method = 'PUT'
@@ -295,7 +294,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
# Tests for the template tag method
def test_token_node_no_csrf_cookie(self):
"""
- Check that CsrfTokenNode works when no CSRF cookie is set
+ CsrfTokenNode works when no CSRF cookie is set.
"""
req = self._get_GET_no_csrf_cookie_request()
resp = token_view(req)
@@ -306,7 +305,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_token_node_empty_csrf_cookie(self):
"""
- Check that we get a new token if the csrf_cookie is the empty string
+ A new token is sent if the csrf_cookie is the empty string.
"""
req = self._get_GET_no_csrf_cookie_request()
req.COOKIES[settings.CSRF_COOKIE_NAME] = b""
@@ -319,7 +318,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_token_node_with_csrf_cookie(self):
"""
- Check that CsrfTokenNode works when a CSRF cookie is set
+ CsrfTokenNode works when a CSRF cookie is set.
"""
req = self._get_GET_csrf_cookie_request()
CsrfViewMiddleware().process_view(req, token_view, (), {})
@@ -328,7 +327,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_get_token_for_exempt_view(self):
"""
- Check that get_token still works for a view decorated with 'csrf_exempt'.
+ get_token still works for a view decorated with 'csrf_exempt'.
"""
req = self._get_GET_csrf_cookie_request()
CsrfViewMiddleware().process_view(req, csrf_exempt(token_view), (), {})
@@ -337,7 +336,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_get_token_for_requires_csrf_token_view(self):
"""
- Check that get_token works for a view decorated solely with requires_csrf_token
+ get_token() works for a view decorated solely with requires_csrf_token.
"""
req = self._get_GET_csrf_cookie_request()
resp = requires_csrf_token(token_view)(req)
@@ -345,7 +344,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
def test_token_node_with_new_csrf_cookie(self):
"""
- Check that CsrfTokenNode works when a CSRF cookie is created by
+ CsrfTokenNode works when a CSRF cookie is created by
the middleware (when one was not already present)
"""
req = self._get_GET_no_csrf_cookie_request()
@@ -389,7 +388,7 @@ class CsrfViewMiddlewareTest(SimpleTestCase):
@override_settings(DEBUG=True, ALLOWED_HOSTS=['www.example.com'])
def test_https_bad_referer(self):
"""
- Test that a POST HTTPS request with a bad referer is rejected
+ A POST HTTPS request with a bad referer is rejected
"""
req = self._get_POST_request_with_token()
req._is_secure_override = True
diff --git a/tests/custom_managers/tests.py b/tests/custom_managers/tests.py
index 63729e43f2..3daaeab131 100644
--- a/tests/custom_managers/tests.py
+++ b/tests/custom_managers/tests.py
@@ -72,7 +72,7 @@ class CustomManagerTests(TestCase):
self.assertQuerysetEqual(queryset, ["Bugs Bunny"], six.text_type)
self.assertIs(queryset._filter_CustomQuerySet, True)
- # Test that specialized querysets inherit from our custom queryset.
+ # Specialized querysets inherit from our custom queryset.
queryset = manager.values_list('first_name', flat=True).filter()
self.assertEqual(list(queryset), [six.text_type("Bugs")])
self.assertIs(queryset._filter_CustomQuerySet, True)
@@ -283,7 +283,7 @@ class CustomManagerTests(TestCase):
Person.objects.create(first_name="Bugs", last_name="Bunny", fun=True, favorite_book=self.b1)
droopy = Person.objects.create(first_name="Droopy", last_name="Dog", fun=False, favorite_book=self.b1)
- # Check that the fun manager DOESN'T remove boring people.
+ # The fun manager DOESN'T remove boring people.
self.b1.favorite_books(manager='fun_people').remove(droopy, bulk=bulk)
self.assertQuerysetEqual(
self.b1.favorite_books(manager='boring_people').all(), [
@@ -292,7 +292,7 @@ class CustomManagerTests(TestCase):
lambda c: c.first_name,
ordered=False,
)
- # Check that the boring manager DOES remove boring people.
+ # The boring manager DOES remove boring people.
self.b1.favorite_books(manager='boring_people').remove(droopy, bulk=bulk)
self.assertQuerysetEqual(
self.b1.favorite_books(manager='boring_people').all(), [
@@ -303,7 +303,7 @@ class CustomManagerTests(TestCase):
droopy.favorite_book = self.b1
droopy.save()
- # Check that the fun manager ONLY clears fun people.
+ # The fun manager ONLY clears fun people.
self.b1.favorite_books(manager='fun_people').clear(bulk=bulk)
self.assertQuerysetEqual(
self.b1.favorite_books(manager='boring_people').all(), [
@@ -363,7 +363,7 @@ class CustomManagerTests(TestCase):
Person.objects.create(first_name="Bugs", last_name="Bunny", fun=True, favorite_thing=self.b1)
droopy = Person.objects.create(first_name="Droopy", last_name="Dog", fun=False, favorite_thing=self.b1)
- # Check that the fun manager DOESN'T remove boring people.
+ # The fun manager DOESN'T remove boring people.
self.b1.favorite_things(manager='fun_people').remove(droopy, bulk=bulk)
self.assertQuerysetEqual(
self.b1.favorite_things(manager='boring_people').all(), [
@@ -373,7 +373,7 @@ class CustomManagerTests(TestCase):
ordered=False,
)
- # Check that the boring manager DOES remove boring people.
+ # The boring manager DOES remove boring people.
self.b1.favorite_things(manager='boring_people').remove(droopy, bulk=bulk)
self.assertQuerysetEqual(
self.b1.favorite_things(manager='boring_people').all(), [
@@ -384,7 +384,7 @@ class CustomManagerTests(TestCase):
droopy.favorite_thing = self.b1
droopy.save()
- # Check that the fun manager ONLY clears fun people.
+ # The fun manager ONLY clears fun people.
self.b1.favorite_things(manager='fun_people').clear(bulk=bulk)
self.assertQuerysetEqual(
self.b1.favorite_things(manager='boring_people').all(), [
@@ -444,7 +444,7 @@ class CustomManagerTests(TestCase):
droopy = Person.objects.create(first_name="Droopy", last_name="Dog", fun=False)
self.b1.authors.add(droopy)
- # Check that the fun manager DOESN'T remove boring people.
+ # The fun manager DOESN'T remove boring people.
self.b1.authors(manager='fun_people').remove(droopy)
self.assertQuerysetEqual(
self.b1.authors(manager='boring_people').all(), [
@@ -454,7 +454,7 @@ class CustomManagerTests(TestCase):
ordered=False,
)
- # Check that the boring manager DOES remove boring people.
+ # The boring manager DOES remove boring people.
self.b1.authors(manager='boring_people').remove(droopy)
self.assertQuerysetEqual(
self.b1.authors(manager='boring_people').all(), [
@@ -464,7 +464,7 @@ class CustomManagerTests(TestCase):
)
self.b1.authors.add(droopy)
- # Check that the fun manager ONLY clears fun people.
+ # The fun manager ONLY clears fun people.
self.b1.authors(manager='fun_people').clear()
self.assertQuerysetEqual(
self.b1.authors(manager='boring_people').all(), [
diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py
index c010a847ca..8d8f03f101 100644
--- a/tests/decorators/tests.py
+++ b/tests/decorators/tests.py
@@ -87,8 +87,7 @@ class DecoratorsTest(TestCase):
def test_attributes(self):
"""
- Tests that django decorators set certain attributes of the wrapped
- function.
+ Built-in decorators set certain attributes of the wrapped function.
"""
self.assertEqual(fully_decorated.__name__, 'fully_decorated')
self.assertEqual(fully_decorated.__doc__, 'Expected __doc__')
@@ -96,8 +95,7 @@ class DecoratorsTest(TestCase):
def test_user_passes_test_composition(self):
"""
- Test that the user_passes_test decorator can be applied multiple times
- (#9474).
+ The user_passes_test decorator can be applied multiple times (#9474).
"""
def test1(user):
user.decorators_applied.append('test1')
@@ -126,10 +124,7 @@ class DecoratorsTest(TestCase):
self.assertEqual(response, ['test2', 'test1'])
- def test_cache_page_new_style(self):
- """
- Test that we can call cache_page the new way
- """
+ def test_cache_page(self):
def my_view(request):
return "response"
my_view_cached = cache_page(123)(my_view)
diff --git a/tests/defer/tests.py b/tests/defer/tests.py
index 8303ab5068..65f1f2bb15 100644
--- a/tests/defer/tests.py
+++ b/tests/defer/tests.py
@@ -227,8 +227,7 @@ class TestDefer2(AssertionMixin, TestCase):
"""
When an inherited model is fetched from the DB, its PK is also fetched.
When getting the PK of the parent model it is useful to use the already
- fetched parent model PK if it happens to be available. Tests that this
- is done.
+ fetched parent model PK if it happens to be available.
"""
s1 = Secondary.objects.create(first="x1", second="y1")
bc = BigChild.objects.create(name="b1", value="foo", related=s1,
diff --git a/tests/delete/tests.py b/tests/delete/tests.py
index d0a1bc5995..bb6dd9c0b6 100644
--- a/tests/delete/tests.py
+++ b/tests/delete/tests.py
@@ -83,7 +83,7 @@ class OnDeleteTests(TestCase):
def test_do_nothing_qscount(self):
"""
- Test that a models.DO_NOTHING relation doesn't trigger a query.
+ A models.DO_NOTHING relation doesn't trigger a query.
"""
b = Base.objects.create()
with self.assertNumQueries(1):
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index e46fdab8e3..f8301b7161 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -349,9 +349,9 @@ class BasicExpressionsTests(TestCase):
self.assertSequenceEqual(qs, [e2, e3])
def test_ticket_18375_join_reuse(self):
- # Test that reverse multijoin F() references and the lookup target
- # the same join. Pre #18375 the F() join was generated first, and the
- # lookup couldn't reuse that join.
+ # Reverse multijoin F() references and the lookup target the same join.
+ # Pre #18375 the F() join was generated first and the lookup couldn't
+ # reuse that join.
qs = Employee.objects.filter(
company_ceo_set__num_chairs=F('company_ceo_set__num_employees'))
self.assertEqual(str(qs.query).count('JOIN'), 1)
@@ -379,7 +379,7 @@ class BasicExpressionsTests(TestCase):
self.assertEqual(str(qs.query).count('JOIN'), 1)
def test_ticket_18375_chained_filters(self):
- # Test that F() expressions do not reuse joins from previous filter.
+ # F() expressions do not reuse joins from previous filter.
qs = Employee.objects.filter(
company_ceo_set__num_employees=F('pk')
).filter(
@@ -553,7 +553,7 @@ class ExpressionsTests(TestCase):
def test_patterns_escape(self):
r"""
- Test that special characters (e.g. %, _ and \) stored in database are
+ Special characters (e.g. %, _ and \) stored in database are
properly escaped when using a pattern lookup with an expression
refs #16731
"""
@@ -585,7 +585,7 @@ class ExpressionsTests(TestCase):
def test_insensitive_patterns_escape(self):
r"""
- Test that special characters (e.g. %, _ and \) stored in database are
+ Special characters (e.g. %, _ and \) stored in database are
properly escaped when using a case insensitive pattern lookup with an
expression -- refs #16731
"""
diff --git a/tests/extra_regress/tests.py b/tests/extra_regress/tests.py
index acf66d4af6..acafd8efde 100644
--- a/tests/extra_regress/tests.py
+++ b/tests/extra_regress/tests.py
@@ -395,7 +395,7 @@ class ExtraRegressTests(TestCase):
def test_regression_17877(self):
"""
- Ensure that extra WHERE clauses get correctly ANDed, even when they
+ Extra WHERE clauses get correctly ANDed, even when they
contain OR operations.
"""
# Test Case 1: should appear in queryset.
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
index 5492f105f7..422435518e 100644
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -161,7 +161,7 @@ class FileStorageTests(SimpleTestCase):
self.assertTrue(timezone.is_aware(dt))
self.assertEqual(now.tzname(), dt.tzname())
- # Check that the three timezones are indeed distinct.
+ # The three timezones are indeed distinct.
naive_now = datetime.now()
algiers_offset = now_in_algiers.tzinfo.utcoffset(naive_now)
django_offset = timezone.get_current_timezone().utcoffset(naive_now)
@@ -192,7 +192,7 @@ class FileStorageTests(SimpleTestCase):
# dt should be naive, in system (+1) TZ
self.assertTrue(timezone.is_naive(dt))
- # Check that the three timezones are indeed distinct.
+ # The three timezones are indeed distinct.
naive_now = datetime.now()
algiers_offset = now_in_algiers.tzinfo.utcoffset(naive_now)
django_offset = timezone.get_current_timezone().utcoffset(naive_now)
@@ -484,7 +484,7 @@ class FileStorageTests(SimpleTestCase):
with self.storage.open('raced/test.file') as f:
self.assertEqual(f.read(), b'saved with race')
- # Check that OSErrors aside from EEXIST are still raised.
+ # OSErrors aside from EEXIST are still raised.
with self.assertRaises(OSError):
self.storage.save('error/test.file', ContentFile('not saved'))
finally:
@@ -520,7 +520,7 @@ class FileStorageTests(SimpleTestCase):
self.storage.delete('raced.file')
self.assertFalse(self.storage.exists('normal.file'))
- # Check that OSErrors aside from ENOENT are still raised.
+ # OSErrors aside from ENOENT are still raised.
self.storage.save('error.file', ContentFile('delete with error'))
with self.assertRaises(OSError):
self.storage.delete('error.file')
@@ -988,8 +988,9 @@ class ContentFileStorageTestCase(unittest.TestCase):
def test_content_saving(self):
"""
- Test that ContentFile can be saved correctly with the filesystem storage,
- both if it was initialized with string or unicode content"""
+ ContentFile can be saved correctly with the filesystem storage,
+ if it was initialized with either bytes or unicode content.
+ """
self.storage.save('bytes.txt', ContentFile(b"content"))
self.storage.save('unicode.txt', ContentFile("español"))
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py
index 9e77e6b0f0..5f6a50250d 100644
--- a/tests/file_uploads/tests.py
+++ b/tests/file_uploads/tests.py
@@ -450,7 +450,7 @@ class FileUploadTests(TestCase):
})
request = response.wsgi_request
- # Check that the files got actually parsed.
+ # The files were parsed.
self.assertTrue(hasattr(request, '_files'))
file = request._files['file']
@@ -469,7 +469,7 @@ class FileUploadTests(TestCase):
})
request = response.wsgi_request
- # Check that the fd closing logic doesn't trigger parsing of the stream
+ # The fd closing logic doesn't trigger parsing of the stream
self.assertFalse(hasattr(request, '_files'))
def test_file_error_blocking(self):
diff --git a/tests/file_uploads/views.py b/tests/file_uploads/views.py
index 058d5b6a14..17d4a1b0f4 100644
--- a/tests/file_uploads/views.py
+++ b/tests/file_uploads/views.py
@@ -17,8 +17,7 @@ from .uploadhandler import ErroringUploadHandler, QuotaUploadHandler
def file_upload_view(request):
"""
- Check that a file upload can be updated into the POST dictionary without
- going pear-shaped.
+ A file upload can be updated into the POST dictionary.
"""
form_data = request.POST.copy()
form_data.update(request.FILES)
diff --git a/tests/files/tests.py b/tests/files/tests.py
index 4ff3b1f49c..72a121fcfe 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -173,14 +173,14 @@ class ContentFileTestCase(unittest.TestCase):
def test_content_file_custom_name(self):
"""
- Test that the constructor of ContentFile accepts 'name' (#16590).
+ The constructor of ContentFile accepts 'name' (#16590).
"""
name = "I can have a name too!"
self.assertEqual(ContentFile(b"content", name=name).name, name)
def test_content_file_input_type(self):
"""
- Test that ContentFile can accept both bytes and unicode and that the
+ ContentFile can accept both bytes and unicode and that the
retrieved content is of the same type.
"""
self.assertIsInstance(ContentFile(b"content").read(), bytes)
@@ -192,7 +192,7 @@ class ContentFileTestCase(unittest.TestCase):
class DimensionClosingBug(unittest.TestCase):
"""
- Test that get_image_dimensions() properly closes files (#8817)
+ get_image_dimensions() properly closes files (#8817)
"""
@unittest.skipUnless(Image, "Pillow not installed")
def test_not_closing_of_files(self):
@@ -242,7 +242,7 @@ class DimensionClosingBug(unittest.TestCase):
class InconsistentGetImageDimensionsBug(unittest.TestCase):
"""
- Test that get_image_dimensions() works properly after various calls
+ get_image_dimensions() works properly after various calls
using a file handler (#11158)
"""
@unittest.skipUnless(Image, "Pillow not installed")
diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py
index 5bff638774..fcf9162345 100644
--- a/tests/fixtures/tests.py
+++ b/tests/fixtures/tests.py
@@ -29,7 +29,7 @@ class TestCaseFixtureLoadingTests(TestCase):
fixtures = ['fixture1.json', 'fixture2.json']
def testClassFixtures(self):
- "Check that test case has installed 3 fixture objects"
+ "Test case has installed 3 fixture objects"
self.assertEqual(Article.objects.count(), 3)
self.assertQuerysetEqual(Article.objects.all(), [
'<Article: Django conquers world!>',
@@ -45,7 +45,7 @@ class SubclassTestCaseFixtureLoadingTests(TestCaseFixtureLoadingTests):
fixtures = []
def testClassFixtures(self):
- "Check that there were no fixture objects installed"
+ "There were no fixture objects installed"
self.assertEqual(Article.objects.count(), 0)
@@ -563,9 +563,8 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
def test_loaddata_error_message(self):
"""
- Verifies that loading a fixture which contains an invalid object
- outputs an error message which contains the pk of the object
- that triggered the error.
+ Loading a fixture which contains an invalid object outputs an error
+ message which contains the pk of the object that triggered the error.
"""
# MySQL needs a little prodding to reject invalid data.
# This won't affect other tests because the database connection
@@ -577,9 +576,6 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
self.assertIn("Could not load fixtures.Article(pk=1):", cm.exception.args[0])
def test_loaddata_app_option(self):
- """
- Verifies that the --app option works.
- """
with self.assertRaisesMessage(CommandError, "No fixture named 'db_fixture_1' found."):
management.call_command('loaddata', 'db_fixture_1', verbosity=0, app_label="someotherapp")
self.assertQuerysetEqual(Article.objects.all(), [])
diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py
index 71fe10528d..cc787e432d 100644
--- a/tests/fixtures_regress/tests.py
+++ b/tests/fixtures_regress/tests.py
@@ -212,7 +212,7 @@ class TestFixtures(TestCase):
@override_settings(SERIALIZATION_MODULES={'unkn': 'unexistent.path'})
def test_unimportable_serializer(self):
"""
- Test that failing serializer import raises the proper error
+ Failing serializer import raises the proper error
"""
with six.assertRaisesRegex(self, ImportError, r"No module named.*unexistent"):
management.call_command(
@@ -363,8 +363,8 @@ class TestFixtures(TestCase):
def test_dumpdata_uses_default_manager(self):
"""
Regression for #11286
- Ensure that dumpdata honors the default manager
- Dump the current contents of the database as a JSON fixture
+ Dumpdata honors the default manager. Dump the current contents of
+ the database as a JSON fixture
"""
management.call_command(
'loaddata',
@@ -617,8 +617,7 @@ class NaturalKeyFixtureTests(TestCase):
def test_nk_on_serialize(self):
"""
- Check that natural key requirements are taken into account
- when serializing models
+ Natural key requirements are taken into account when serializing models.
"""
management.call_command(
'loaddata',
@@ -651,10 +650,8 @@ class NaturalKeyFixtureTests(TestCase):
def test_dependency_sorting(self):
"""
- Now lets check the dependency sorting explicitly
- It doesn't matter what order you mention the models
- Store *must* be serialized before then Person, and both
- must be serialized before Book.
+ It doesn't matter what order you mention the models, Store *must* be
+ serialized before then Person, and both must be serialized before Book.
"""
sorted_deps = serializers.sort_dependencies(
[('fixtures_regress', [Book, Person, Store])]
@@ -762,8 +759,7 @@ class NaturalKeyFixtureTests(TestCase):
def test_normal_pk(self):
"""
- Check that normal primary keys still work
- on a model with natural key capabilities
+ Normal primary keys work on a model with natural key capabilities.
"""
management.call_command(
'loaddata',
@@ -900,7 +896,7 @@ class TestTicket11101(TransactionTestCase):
@skipUnlessDBFeature('supports_transactions')
def test_ticket_11101(self):
- """Test that fixtures can be rolled back (ticket #11101)."""
+ """Fixtures can be rolled back (ticket #11101)."""
with transaction.atomic():
management.call_command(
'loaddata',
diff --git a/tests/foreign_object/test_empty_join.py b/tests/foreign_object/test_empty_join.py
index a043595ce2..5313699122 100644
--- a/tests/foreign_object/test_empty_join.py
+++ b/tests/foreign_object/test_empty_join.py
@@ -17,7 +17,7 @@ class RestrictedConditionsTests(TestCase):
def test_restrictions_with_no_joining_columns(self):
"""
- Test that it's possible to create a working related field that doesn't
+ It's possible to create a working related field that doesn't
use any joining columns, as long as an extra restriction is supplied.
"""
a = SlugPage.objects.get(slug='a')
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py
index 93df8d6cc1..3c1f5bdfb4 100644
--- a/tests/foreign_object/tests.py
+++ b/tests/foreign_object/tests.py
@@ -398,7 +398,6 @@ class MultiColumnFKTests(TestCase):
@skipUnlessDBFeature('has_bulk_insert')
def test_batch_create_foreign_object(self):
- """ See: https://code.djangoproject.com/ticket/21566 """
objs = [Person(name="abcd_%s" % i, person_country=self.usa) for i in range(0, 5)]
Person.objects.bulk_create(objs, 10)
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index 5ae4ca042f..8007ad85af 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -8,7 +8,7 @@ import uuid
from django.core.exceptions import NON_FIELD_ERRORS
from django.core.files.uploadedfile import SimpleUploadedFile
-from django.core.validators import RegexValidator
+from django.core.validators import MaxValueValidator, RegexValidator
from django.forms import (
BooleanField, CharField, CheckboxSelectMultiple, ChoiceField, DateField,
DateTimeField, EmailField, FileField, FloatField, Form, HiddenInput,
@@ -1134,7 +1134,7 @@ value="Should escape &lt; &amp; &gt; and &lt;script&gt;alert(&#39;xss&#39;)&lt;/
except ValidationError as e:
self._errors = e.update_error_dict(self._errors)
- # Ensure that the newly added list of errors is an instance of ErrorList.
+ # The newly added list of errors is an instance of ErrorList.
for field, error_list in self._errors.items():
if not isinstance(error_list, self.error_class):
self._errors[field] = self.error_class(error_list)
@@ -1143,7 +1143,7 @@ value="Should escape &lt; &amp; &gt; and &lt;script&gt;alert(&#39;xss&#39;)&lt;/
# Trigger validation.
self.assertFalse(form.is_valid())
- # Check that update_error_dict didn't lose track of the ErrorDict type.
+ # update_error_dict didn't lose track of the ErrorDict type.
self.assertIsInstance(form._errors, forms.ErrorDict)
self.assertEqual(dict(form.errors), {
@@ -1325,10 +1325,10 @@ value="Should escape &lt; &amp; &gt; and &lt;script&gt;alert(&#39;xss&#39;)&lt;/
self.assertEqual(f['gender'].field.choices, [('f', 'Female'), ('m', 'Male')])
def test_validators_independence(self):
- """ Test that we are able to modify a form field validators list without polluting
- other forms """
- from django.core.validators import MaxValueValidator
-
+ """
+ The list of form field validators can be modified without polluting
+ other forms.
+ """
class MyForm(Form):
myfield = CharField(max_length=25)
@@ -1931,7 +1931,7 @@ Password: <input type="password" name="password" required /></li>
self.assertIn('last_name', p.changed_data)
self.assertNotIn('birthday', p.changed_data)
- # Test that field raising ValidationError is always in changed_data
+ # A field raising ValidationError is always in changed_data
class PedanticField(forms.Field):
def to_python(self, value):
raise ValidationError('Whatever')
@@ -1990,7 +1990,7 @@ Password: <input type="password" name="password" required /></li>
def test_boundfield_rendering(self):
"""
- Python 2 issue: Test that rendering a BoundField with bytestring content
+ Python 2 issue: Rendering a BoundField with bytestring content
doesn't lose it's safe string status (#22950).
"""
class CustomWidget(TextInput):
@@ -2937,7 +2937,7 @@ Good luck picking a username that doesn&#39;t already exist.</p>
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):
<td><input type="text" name="form-1-name" id="id_form-1-name" /></td></tr>"""
)
- # 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):
<script type="text/javascript" src="/path/to/js4"></script>"""
)
- # Check that media addition hasn't affected the original objects
+ # media addition hasn't affected the original objects
self.assertEqual(
str(w1.media),
"""<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet" />
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" /></p>""" % 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$'), ['<Season: 2013>'])
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), [
"<Person: Jim>",
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(), ['<Publication: Science Weekly>'])
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'),
["<Article: John's second story>", "<Article: This is a test>"]
)
- # Check that implied __exact also works
+ # Implied __exact also works
self.assertQuerysetEqual(
Article.objects.filter(reporter__first_name='John'),
["<Article: John's second story>", "<Article: This is a test>"]
@@ -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 <field>_set manager does not join on Null value fields (#17541)
+ # The <field>_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("<b>Hello Django!</b>"))
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)), '<Tag: t1>')
@@ -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, '<priority>0.5</priority>')
self.assertContains(response, '<lastmod>%s</lastmod>' % 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 = """<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@@ -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 = """<?xml version="1.0" encoding="UTF-8"?>
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 &amp; 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 &amp; 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 <field>_id for foreign keys
+ Update works using <field>_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, '<div class="context" id="', status_code=400)
@@ -325,7 +325,7 @@ class ExceptionReporterTests(SimpleTestCase):
self.assertIn('<p>Request data not supplied</p>', html)
def test_eol_support(self):
- """Test that the ExceptionReporter supports Unix, Windows and Macintosh EOL markers"""
+ """The ExceptionReporter supports Unix, Windows and Macintosh EOL markers"""
LINES = list('print %d' % i for i in range(1, 6))
reporter = ExceptionReporter(None, None, None, None)
@@ -789,14 +789,13 @@ class ExceptionReportTestMixin(object):
@override_settings(ROOT_URLCONF='view_tests.urls')
class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin, SimpleTestCase):
"""
- Ensure that sensitive information can be filtered out of error reports.
- Refs #14614.
+ Sensitive information can be filtered out of error reports (#14614).
"""
rf = RequestFactory()
def test_non_sensitive_request(self):
"""
- Ensure that everything (request info and frame variables) can bee seen
+ Everything (request info and frame variables) can bee seen
in the default error reports for non-sensitive requests.
"""
with self.settings(DEBUG=True):
@@ -809,7 +808,7 @@ class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin
def test_sensitive_request(self):
"""
- Ensure that sensitive POST parameters and frame variables cannot be
+ Sensitive POST parameters and frame variables cannot be
seen in the default error reports for sensitive requests.
"""
with self.settings(DEBUG=True):
@@ -822,7 +821,7 @@ class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin
def test_paranoid_request(self):
"""
- Ensure that no POST parameters and frame variables can be seen in the
+ No POST parameters and frame variables can be seen in the
default error reports for "paranoid" requests.
"""
with self.settings(DEBUG=True):
@@ -835,7 +834,7 @@ class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin
def test_multivalue_dict_key_error(self):
"""
- #21098 -- Ensure that sensitive POST parameters cannot be seen in the
+ #21098 -- Sensitive POST parameters cannot be seen in the
error reports for if request.POST['nonexistent_key'] throws an error.
"""
with self.settings(DEBUG=True):
@@ -848,7 +847,7 @@ class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin
def test_custom_exception_reporter_filter(self):
"""
- Ensure that it's possible to assign an exception reporter filter to
+ It's possible to assign an exception reporter filter to
the request to bypass the one set in DEFAULT_EXCEPTION_REPORTER_FILTER.
"""
with self.settings(DEBUG=True):
@@ -861,28 +860,21 @@ class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin
def test_sensitive_method(self):
"""
- Ensure that the sensitive_variables decorator works with object
- methods.
- Refs #18379.
+ The sensitive_variables decorator works with object methods.
"""
with self.settings(DEBUG=True):
- self.verify_unsafe_response(sensitive_method_view,
- check_for_POST_params=False)
- self.verify_unsafe_email(sensitive_method_view,
- check_for_POST_params=False)
+ self.verify_unsafe_response(sensitive_method_view, check_for_POST_params=False)
+ self.verify_unsafe_email(sensitive_method_view, check_for_POST_params=False)
with self.settings(DEBUG=False):
- self.verify_safe_response(sensitive_method_view,
- check_for_POST_params=False)
- self.verify_safe_email(sensitive_method_view,
- check_for_POST_params=False)
+ self.verify_safe_response(sensitive_method_view, check_for_POST_params=False)
+ self.verify_safe_email(sensitive_method_view, check_for_POST_params=False)
def test_sensitive_function_arguments(self):
"""
- Ensure that sensitive variables don't leak in the sensitive_variables
- decorator's frame, when those variables are passed as arguments to the
- decorated function.
- Refs #19453.
+ Sensitive variables don't leak in the sensitive_variables decorator's
+ frame, when those variables are passed as arguments to the decorated
+ function.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(sensitive_args_function_caller)
@@ -894,10 +886,9 @@ class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin
def test_sensitive_function_keyword_arguments(self):
"""
- Ensure that sensitive variables don't leak in the sensitive_variables
- decorator's frame, when those variables are passed as keyword arguments
- to the decorated function.
- Refs #19453.
+ Sensitive variables don't leak in the sensitive_variables decorator's
+ frame, when those variables are passed as keyword arguments to the
+ decorated function.
"""
with self.settings(DEBUG=True):
self.verify_unsafe_response(sensitive_kwargs_function_caller)
@@ -980,7 +971,7 @@ class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin
class AjaxResponseExceptionReporterFilter(ExceptionReportTestMixin, LoggingCaptureMixin, SimpleTestCase):
"""
- Ensure that sensitive information can be filtered out of error reports.
+ Sensitive information can be filtered out of error reports.
Here we specifically test the plain text 500 debug-only error page served
when it has been detected the request was sent by JS code. We don't check
@@ -992,7 +983,7 @@ class AjaxResponseExceptionReporterFilter(ExceptionReportTestMixin, LoggingCaptu
def test_non_sensitive_request(self):
"""
- Ensure that request info can bee seen in the default error reports for
+ Request info can bee seen in the default error reports for
non-sensitive requests.
"""
with self.settings(DEBUG=True):
@@ -1003,7 +994,7 @@ class AjaxResponseExceptionReporterFilter(ExceptionReportTestMixin, LoggingCaptu
def test_sensitive_request(self):
"""
- Ensure that sensitive POST parameters cannot be seen in the default
+ Sensitive POST parameters cannot be seen in the default
error reports for sensitive requests.
"""
with self.settings(DEBUG=True):
@@ -1014,7 +1005,7 @@ class AjaxResponseExceptionReporterFilter(ExceptionReportTestMixin, LoggingCaptu
def test_paranoid_request(self):
"""
- Ensure that no POST parameters can be seen in the default error reports
+ No POST parameters can be seen in the default error reports
for "paranoid" requests.
"""
with self.settings(DEBUG=True):
@@ -1025,7 +1016,7 @@ class AjaxResponseExceptionReporterFilter(ExceptionReportTestMixin, LoggingCaptu
def test_custom_exception_reporter_filter(self):
"""
- Ensure that it's possible to assign an exception reporter filter to
+ It's possible to assign an exception reporter filter to
the request to bypass the one set in DEFAULT_EXCEPTION_REPORTER_FILTER.
"""
with self.settings(DEBUG=True):
diff --git a/tests/view_tests/tests/test_defaults.py b/tests/view_tests/tests/test_defaults.py
index 135b8d2c9a..1b5ad25102 100644
--- a/tests/view_tests/tests/test_defaults.py
+++ b/tests/view_tests/tests/test_defaults.py
@@ -86,8 +86,7 @@ class DefaultsTests(TestCase):
}])
def test_custom_templates(self):
"""
- Test that 404.html and 500.html templates are picked by their respective
- handler.
+ 404.html and 500.html templates are picked by their respective handler.
"""
response = self.client.get('/server_error/')
self.assertContains(response, "test template for a 500 error", status_code=500)
diff --git a/tests/view_tests/tests/test_specials.py b/tests/view_tests/tests/test_specials.py
index 59428f9a8f..8ef766e86f 100644
--- a/tests/view_tests/tests/test_specials.py
+++ b/tests/view_tests/tests/test_specials.py
@@ -13,15 +13,14 @@ class URLHandling(SimpleTestCase):
def test_nonascii_redirect(self):
"""
- Tests that a non-ASCII argument to HttpRedirect is handled properly.
+ A non-ASCII argument to HttpRedirect is handled properly.
"""
response = self.client.get('/nonascii_redirect/')
self.assertRedirects(response, self.redirect_target)
def test_permanent_nonascii_redirect(self):
"""
- Tests that a non-ASCII argument to HttpPermanentRedirect is handled
- properly.
+ A non-ASCII argument to HttpPermanentRedirect is handled properly.
"""
response = self.client.get('/permanent_nonascii_redirect/')
self.assertRedirects(response, self.redirect_target, status_code=301)
diff --git a/tests/view_tests/tests/test_static.py b/tests/view_tests/tests/test_static.py
index 8492ec4547..457577264e 100644
--- a/tests/view_tests/tests/test_static.py
+++ b/tests/view_tests/tests/test_static.py
@@ -130,8 +130,7 @@ class StaticHelperTest(StaticTests):
class StaticUtilsTests(unittest.TestCase):
def test_was_modified_since_fp(self):
"""
- Test that a floating point mtime does not disturb was_modified_since.
- (#18675)
+ A floating point mtime does not disturb was_modified_since (#18675).
"""
mtime = 1343416141.107817
header = http_date(mtime)
diff --git a/tests/view_tests/views.py b/tests/view_tests/views.py
index 97b984b758..bfcdc20a13 100644
--- a/tests/view_tests/views.py
+++ b/tests/view_tests/views.py
@@ -32,8 +32,7 @@ def with_parameter(request, parameter):
def raises(request):
# Make sure that a callable that raises an exception in the stack frame's
- # local vars won't hijack the technical 500 response. See:
- # http://code.djangoproject.com/ticket/15025
+ # local vars won't hijack the technical 500 response (#15025).
def callable():
raise Exception
try:
diff --git a/tests/wsgi/tests.py b/tests/wsgi/tests.py
index 99076f56bd..e07f8d2478 100644
--- a/tests/wsgi/tests.py
+++ b/tests/wsgi/tests.py
@@ -20,8 +20,7 @@ class WSGITest(SimpleTestCase):
def test_get_wsgi_application(self):
"""
- Verify that ``get_wsgi_application`` returns a functioning WSGI
- callable.
+ get_wsgi_application() returns a functioning WSGI callable.
"""
application = get_wsgi_application()
@@ -50,7 +49,7 @@ class WSGITest(SimpleTestCase):
def test_file_wrapper(self):
"""
- Verify that FileResponse uses wsgi.file_wrapper.
+ FileResponse uses wsgi.file_wrapper.
"""
class FileWrapper(object):
def __init__(self, filelike, blksize=8192):