diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index ff6aa94be4..ba7e36c8c2 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -352,7 +352,7 @@ class BaseModelAdmin(metaclass=forms.MediaDefiningClass): try: field = model._meta.get_field(part) except FieldDoesNotExist: - # Lookups on non-existent fields are ok, since they're ignored + # Lookups on nonexistent fields are ok, since they're ignored # later. break # It is allowed to filter on values that would be found from local diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py index e0fbd21b38..64f9af38ba 100644 --- a/django/contrib/auth/backends.py +++ b/django/contrib/auth/backends.py @@ -16,7 +16,7 @@ class ModelBackend: user = UserModel._default_manager.get_by_natural_key(username) except UserModel.DoesNotExist: # Run the default password hasher once to reduce the timing - # difference between an existing and a non-existing user (#20760). + # difference between an existing and a nonexistent user (#20760). UserModel().set_password(password) else: if user.check_password(password) and self.user_can_authenticate(user): diff --git a/django/contrib/contenttypes/fields.py b/django/contrib/contenttypes/fields.py index c2b46d1254..df6113f462 100644 --- a/django/contrib/contenttypes/fields.py +++ b/django/contrib/contenttypes/fields.py @@ -97,7 +97,8 @@ class GenericForeignKey: except FieldDoesNotExist: return [ checks.Error( - "The GenericForeignKey object ID references the non-existent field '%s'." % self.fk_field, + "The GenericForeignKey object ID references the " + "nonexistent field '%s'." % self.fk_field, obj=self, id='contenttypes.E001', ) @@ -115,7 +116,8 @@ class GenericForeignKey: except FieldDoesNotExist: return [ checks.Error( - "The GenericForeignKey content type references the non-existent field '%s.%s'." % ( + "The GenericForeignKey content type references the " + "nonexistent field '%s.%s'." % ( self.model._meta.object_name, self.ct_field ), obj=self, diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py index 6be2378e56..8f87f487bf 100644 --- a/django/core/cache/backends/memcached.py +++ b/django/core/cache/backends/memcached.py @@ -108,7 +108,7 @@ class BaseMemcachedCache(BaseCache): try: val = self._cache.incr(key, delta) - # python-memcache responds to incr on non-existent keys by + # python-memcache responds to incr on nonexistent keys by # raising a ValueError, pylibmc by raising a pylibmc.NotFound # and Cmemcache returns None. In all cases, # we should raise a ValueError though. @@ -126,7 +126,7 @@ class BaseMemcachedCache(BaseCache): try: val = self._cache.decr(key, delta) - # python-memcache responds to incr on non-existent keys by + # python-memcache responds to incr on nonexistent keys by # raising a ValueError, pylibmc by raising a pylibmc.NotFound # and Cmemcache returns None. In all cases, # we should raise a ValueError though. diff --git a/django/db/models/base.py b/django/db/models/base.py index 497a18f51a..2914ba2a6f 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -1497,7 +1497,7 @@ class Model(metaclass=ModelBase): except KeyError: errors.append( checks.Error( - "'%s' refers to the non-existent field '%s'." % ( + "'%s' refers to the nonexistent field '%s'." % ( option, field_name, ), obj=cls, @@ -1570,7 +1570,7 @@ class Model(metaclass=ModelBase): # but is an alias and therefore won't be found by opts.get_field. fields = {f for f in fields if f != 'pk'} - # Check for invalid or non-existent fields in ordering. + # Check for invalid or nonexistent fields in ordering. invalid_fields = [] # Any field name that is not present in field_names does not exist. @@ -1586,7 +1586,7 @@ class Model(metaclass=ModelBase): for invalid_field in invalid_fields: errors.append( checks.Error( - "'ordering' refers to the non-existent field '%s'." % invalid_field, + "'ordering' refers to the nonexistent field '%s'." % invalid_field, obj=cls, id='models.E015', ) diff --git a/django/db/models/query.py b/django/db/models/query.py index 244cfaf164..290be2e779 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -1267,7 +1267,7 @@ class RawQuerySet: index = columns.index(query_name) columns[index] = model_name except ValueError: - # Ignore translations for non-existent column names + # Ignore translations for nonexistent column names pass return columns diff --git a/docs/faq/admin.txt b/docs/faq/admin.txt index 26ad08374f..f1c6f61eba 100644 --- a/docs/faq/admin.txt +++ b/docs/faq/admin.txt @@ -62,7 +62,7 @@ Some objects aren't appearing in the admin. Inconsistent row counts may be caused by missing foreign key values or a foreign key field incorrectly set to :attr:`null=False `. If you have a record with a -:class:`~django.db.models.ForeignKey` pointing to a non-existent object and +:class:`~django.db.models.ForeignKey` pointing to a nonexistent object and that foreign key is included is :attr:`~django.contrib.admin.ModelAdmin.list_display`, the record will not be shown in the admin changelist because the Django model is declaring an diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt index 35c0bd6987..d71219f5be 100644 --- a/docs/ref/checks.txt +++ b/docs/ref/checks.txt @@ -281,13 +281,13 @@ Models * **models.E010**: ``unique_together`` must be a list or tuple. * **models.E011**: All ``unique_together`` elements must be lists or tuples. * **models.E012**: ``index_together/unique_together`` refers to the - non-existent field ````. + nonexistent field ````. * **models.E013**: ``index_together/unique_together`` refers to a ``ManyToManyField`` ````, but ``ManyToManyField``\s are not supported for that option. * **models.E014**: ``ordering`` must be a tuple or list (even if you want to order by only one field). -* **models.E015**: ``ordering`` refers to the non-existent field +* **models.E015**: ``ordering`` refers to the nonexistent field ````. * **models.E016**: ``index_together/unique_together`` refers to field ```` which is not local to model ````. @@ -659,9 +659,9 @@ The following checks are performed when a model contains a :class:`~django.contrib.contenttypes.fields.GenericRelation`: * **contenttypes.E001**: The ``GenericForeignKey`` object ID references the - non-existent field ````. + nonexistent field ````. * **contenttypes.E002**: The ``GenericForeignKey`` content type references the - non-existent field ````. + nonexistent field ````. * **contenttypes.E003**: ```` is not a ``ForeignKey``. * **contenttypes.E004**: ```` is not a ``ForeignKey`` to ``contenttypes.ContentType``. diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 2d564d1954..6de18234c4 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -323,10 +323,10 @@ Methods 'Tony' >>> request.get_signed_cookie('name', salt='name-salt') 'Tony' # assuming cookie was set using the same salt - >>> request.get_signed_cookie('non-existing-cookie') + >>> request.get_signed_cookie('nonexistent-cookie') ... - KeyError: 'non-existing-cookie' - >>> request.get_signed_cookie('non-existing-cookie', False) + KeyError: 'nonexistent-cookie' + >>> request.get_signed_cookie('nonexistent-cookie', False) False >>> request.get_signed_cookie('cookie-that-was-tampered-with') ... diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt index afa43f7abd..c4f250e667 100644 --- a/docs/ref/templates/api.txt +++ b/docs/ref/templates/api.txt @@ -381,7 +381,7 @@ replaced with the name of the invalid variable. idea to turn it on as a 'development default'. Many templates, including those in the Admin site, rely upon the silence - of the template system when a non-existent variable is encountered. If you + of the template system when a nonexistent variable is encountered. If you assign a value other than ``''`` to ``string_if_invalid``, you will experience rendering problems with these templates and sites. diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index 1e37d28ca8..c9ab5e3975 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -984,7 +984,7 @@ appropriate entities. ``value`` aware during a DST transition such that the time never occurred (when entering into DST). Setting ``is_dst`` to ``True`` or ``False`` will avoid the exception by moving the hour backwards or forwards by 1 - respectively. For example, ``is_dst=True`` would change a non-existent + respectively. For example, ``is_dst=True`` would change a nonexistent time of 2:30 to 1:30 and ``is_dst=False`` would change the time to 3:30. .. function:: make_naive(value, timezone=None) diff --git a/docs/releases/0.96.txt b/docs/releases/0.96.txt index bbec1c3eaf..21267910c7 100644 --- a/docs/releases/0.96.txt +++ b/docs/releases/0.96.txt @@ -65,7 +65,7 @@ The effect of this change is that running ``manage.py reset`` and similar commands against an existing database may generate SQL with the new form of constraint name, while the database itself contains constraints named in the old form; this will cause the database server -to raise an error message about modifying non-existent constraints. +to raise an error message about modifying nonexistent constraints. If you need to work around this, there are two methods available: diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py index e081caeca1..5419fc1009 100644 --- a/tests/admin_checks/tests.py +++ b/tests/admin_checks/tests.py @@ -344,7 +344,10 @@ class SystemChecksTestCase(SimpleTestCase): self.assertEqual(errors, expected) def test_generic_inline_model_admin_bad_ct_field(self): - "A GenericInlineModelAdmin raises problems if the ct_field points to a non-existent field." + """ + A GenericInlineModelAdmin errors if the ct_field points to a + nonexistent field. + """ class InfluenceInline(GenericStackedInline): model = Influence ct_field = 'nonexistent' @@ -363,7 +366,10 @@ class SystemChecksTestCase(SimpleTestCase): self.assertEqual(errors, expected) def test_generic_inline_model_admin_bad_fk_field(self): - "A GenericInlineModelAdmin raises problems if the ct_fk_field points to a non-existent field." + """ + A GenericInlineModelAdmin errors if the ct_fk_field points to a + nonexistent field. + """ class InfluenceInline(GenericStackedInline): model = Influence ct_fk_field = 'nonexistent' @@ -428,18 +434,15 @@ class SystemChecksTestCase(SimpleTestCase): self.assertEqual(errors, expected) def test_app_label_in_admin_checks(self): - """ - Regression test for #15669 - Include app label in admin system check messages - """ - class RawIdNonexistingAdmin(admin.ModelAdmin): - raw_id_fields = ('nonexisting',) + class RawIdNonexistentAdmin(admin.ModelAdmin): + raw_id_fields = ('nonexistent',) - errors = RawIdNonexistingAdmin(Album, AdminSite()).check() + errors = RawIdNonexistentAdmin(Album, AdminSite()).check() expected = [ checks.Error( - "The value of 'raw_id_fields[0]' refers to 'nonexisting', " + "The value of 'raw_id_fields[0]' refers to 'nonexistent', " "which is not an attribute of 'admin_checks.Album'.", - obj=RawIdNonexistingAdmin, + obj=RawIdNonexistentAdmin, id='admin.E002', ) ] diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index 177d24892a..88e547a8c2 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1132,9 +1132,7 @@ class ManageCheck(AdminScriptTestCase): self.remove_settings('settings.py') def test_nonexistent_app(self): - """ manage.py check reports an error on a non-existent app in - INSTALLED_APPS """ - + """check reports an error on a nonexistent app in INSTALLED_APPS.""" self.write_settings( 'settings.py', apps=['admin_scriptz.broken_app'], diff --git a/tests/admin_utils/test_logentry.py b/tests/admin_utils/test_logentry.py index c2eee96f48..b568a59336 100644 --- a/tests/admin_utils/test_logentry.py +++ b/tests/admin_utils/test_logentry.py @@ -150,14 +150,14 @@ class LogEntryTests(TestCase): def test_logentry_get_admin_url(self): """ LogEntry.get_admin_url returns a URL to edit the entry's object or - None for non-existent (possibly deleted) models. + None for nonexistent (possibly deleted) models. """ logentry = LogEntry.objects.get(content_type__model__iexact='article') expected_url = reverse('admin:admin_utils_article_change', args=(quote(self.a1.pk),)) self.assertEqual(logentry.get_admin_url(), expected_url) self.assertIn('article/%d/change/' % self.a1.pk, logentry.get_admin_url()) - logentry.content_type.model = "non-existent" + logentry.content_type.model = "nonexistent" self.assertIsNone(logentry.get_admin_url()) def test_logentry_unicode(self): diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index b0ec18968e..aaef915ee9 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -222,7 +222,7 @@ class AdminForeignKeyRawIdWidget(TestDataMixin, TestCase): post_data = { "main_band": '%s' % pk, } - # Try posting with a non-existent pk in a raw id field: this + # Try posting with a nonexistent pk in a raw id field: this # should result in an error message, not a server exception. response = self.client.post(reverse('admin:admin_widgets_event_add'), post_data) self.assertContains(response, 'Select a valid choice. That choice is not one of the available choices.') diff --git a/tests/auth_tests/templates/context_processors/auth_attrs_perm_in_perms.html b/tests/auth_tests/templates/context_processors/auth_attrs_perm_in_perms.html index 3a18cd7405..04f26e624b 100644 --- a/tests/auth_tests/templates/context_processors/auth_attrs_perm_in_perms.html +++ b/tests/auth_tests/templates/context_processors/auth_attrs_perm_in_perms.html @@ -1,4 +1,4 @@ {% if 'auth' in perms %}Has auth permissions{% endif %} {% if 'auth.add_permission' in perms %}Has auth.add_permission permissions{% endif %} -{% if 'nonexisting' in perms %}nonexisting perm found{% endif %} -{% if 'auth.nonexisting' in perms %}auth.nonexisting perm found{% endif %} +{% if 'nonexistent' in perms %}nonexistent perm found{% endif %} +{% if 'auth.nonexistent' in perms %}auth.nonexistent perm found{% endif %} diff --git a/tests/auth_tests/templates/context_processors/auth_attrs_perms.html b/tests/auth_tests/templates/context_processors/auth_attrs_perms.html index 6f441afc10..b1c829bd98 100644 --- a/tests/auth_tests/templates/context_processors/auth_attrs_perms.html +++ b/tests/auth_tests/templates/context_processors/auth_attrs_perms.html @@ -1,4 +1,4 @@ {% if perms.auth %}Has auth permissions{% endif %} {% if perms.auth.add_permission %}Has auth.add_permission permissions{% endif %} -{% if perms.nonexisting %}nonexisting perm found{% endif %} -{% if perms.auth.nonexisting in perms %}auth.nonexisting perm found{% endif %} +{% if perms.nonexistent %}nonexistent perm found{% endif %} +{% if perms.auth.nonexistent in perms %}auth.nonexistent perm found{% endif %} diff --git a/tests/auth_tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py index 5b93800386..4c4652cd1b 100644 --- a/tests/auth_tests/test_context_processors.py +++ b/tests/auth_tests/test_context_processors.py @@ -44,9 +44,9 @@ class PermWrapperTests(SimpleTestCase): perms = PermWrapper(MockUser()) # Works for modules and full permissions. self.assertIn('mockapp', perms) - self.assertNotIn('nonexisting', perms) + self.assertNotIn('nonexistent', perms) self.assertIn('mockapp.someperm', perms) - self.assertNotIn('mockapp.nonexisting', perms) + self.assertNotIn('mockapp.nonexistent', perms) def test_permlookupdict_in(self): """ @@ -95,7 +95,7 @@ class AuthContextProcessorTests(TestCase): response = self.client.get('/auth_processor_perms/') self.assertContains(response, "Has auth permissions") self.assertContains(response, "Has auth.add_permission permissions") - self.assertNotContains(response, "nonexisting") + self.assertNotContains(response, "nonexistent") def test_perm_in_perms_attrs(self): u = User.objects.create_user(username='normal', password='secret') @@ -107,7 +107,7 @@ class AuthContextProcessorTests(TestCase): response = self.client.get('/auth_processor_perm_in_perms/') self.assertContains(response, "Has auth permissions") self.assertContains(response, "Has auth.add_permission permissions") - self.assertNotContains(response, "nonexisting") + self.assertNotContains(response, "nonexistent") def test_message_attrs(self): self.client.force_login(self.superuser) diff --git a/tests/auth_tests/test_decorators.py b/tests/auth_tests/test_decorators.py index 55c422bdc6..befe5c4d27 100644 --- a/tests/auth_tests/test_decorators.py +++ b/tests/auth_tests/test_decorators.py @@ -97,7 +97,7 @@ class PermissionsRequiredDecoratorTest(TestCase): def test_permissioned_denied_redirect(self): - @permission_required(['auth_tests.add_customuser', 'auth_tests.change_customuser', 'non-existent-permission']) + @permission_required(['auth_tests.add_customuser', 'auth_tests.change_customuser', 'nonexistent-permission']) def a_view(request): return HttpResponse() request = self.factory.get('/rand') @@ -108,7 +108,7 @@ class PermissionsRequiredDecoratorTest(TestCase): def test_permissioned_denied_exception_raised(self): @permission_required([ - 'auth_tests.add_customuser', 'auth_tests.change_customuser', 'non-existent-permission' + 'auth_tests.add_customuser', 'auth_tests.change_customuser', 'nonexistent-permission' ], raise_exception=True) def a_view(request): return HttpResponse() diff --git a/tests/auth_tests/test_deprecated_views.py b/tests/auth_tests/test_deprecated_views.py index ba43140ebe..be3b990494 100644 --- a/tests/auth_tests/test_deprecated_views.py +++ b/tests/auth_tests/test_deprecated_views.py @@ -191,7 +191,7 @@ class PasswordResetTest(AuthViewsTestCase): self.assertContains(response, "The password reset link was invalid") def test_confirm_invalid_user(self): - # We get a 200 response for a non-existent user, not a 404 + # We get a 200 response for a nonexistent user, not a 404 response = self.client.get('/reset/123456/1-1/') self.assertContains(response, "The password reset link was invalid") diff --git a/tests/auth_tests/test_mixins.py b/tests/auth_tests/test_mixins.py index 0a0c5ccdf4..70e8f27675 100644 --- a/tests/auth_tests/test_mixins.py +++ b/tests/auth_tests/test_mixins.py @@ -238,7 +238,7 @@ class PermissionsRequiredMixinTests(TestCase): def test_permissioned_denied_redirect(self): class AView(PermissionRequiredMixin, EmptyResponseView): permission_required = [ - 'auth_tests.add_customuser', 'auth_tests.change_customuser', 'non-existent-permission', + 'auth_tests.add_customuser', 'auth_tests.change_customuser', 'nonexistent-permission', ] request = self.factory.get('/rand') @@ -249,7 +249,7 @@ class PermissionsRequiredMixinTests(TestCase): def test_permissioned_denied_exception_raised(self): class AView(PermissionRequiredMixin, EmptyResponseView): permission_required = [ - 'auth_tests.add_customuser', 'auth_tests.change_customuser', 'non-existent-permission', + 'auth_tests.add_customuser', 'auth_tests.change_customuser', 'nonexistent-permission', ] raise_exception = True diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py index cee3383f05..7436473635 100644 --- a/tests/auth_tests/test_views.py +++ b/tests/auth_tests/test_views.py @@ -234,7 +234,7 @@ class PasswordResetTest(AuthViewsTestCase): self.assertContains(response, "The password reset link was invalid") def test_confirm_invalid_user(self): - # A non-existent user returns a 200 response, not a 404. + # A nonexistent 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") diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 6b462f29c2..733bc1341a 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -83,7 +83,7 @@ class DummyCacheTests(SimpleTestCase): self.assertIsNone(cache.get("addkey1")) def test_non_existent(self): - "Non-existent keys aren't found in the dummy cache backend" + "Nonexistent keys aren't found in the dummy cache backend" self.assertIsNone(cache.get("does_not_exist")) self.assertEqual(cache.get("does_not_exist", "bang!"), "bang!") @@ -280,8 +280,7 @@ class BaseCacheTests: self.assertEqual(caches['prefix'].get('somekey'), 'value2') def test_non_existent(self): - # Non-existent cache keys return as None/default - # get with non-existent keys + """Nonexistent cache keys return as None/default.""" self.assertIsNone(cache.get("does_not_exist")) self.assertEqual(cache.get("does_not_exist", "bang!"), "bang!") diff --git a/tests/contenttypes_tests/tests.py b/tests/contenttypes_tests/tests.py index 794b1e34ef..14e14e0913 100644 --- a/tests/contenttypes_tests/tests.py +++ b/tests/contenttypes_tests/tests.py @@ -154,7 +154,7 @@ class GenericForeignKeyTests(SimpleTestCase): errors = TaggedItem.content_object.check() expected = [ checks.Error( - "The GenericForeignKey content type references the non-existent field 'TaggedItem.content_type'.", + "The GenericForeignKey content type references the nonexistent field 'TaggedItem.content_type'.", obj=TaggedItem.content_object, id='contenttypes.E002', ) @@ -212,7 +212,7 @@ class GenericForeignKeyTests(SimpleTestCase): errors = TaggedItem.content_object.check() expected = [ checks.Error( - "The GenericForeignKey object ID references the non-existent field 'object_id'.", + "The GenericForeignKey object ID references the nonexistent field 'object_id'.", obj=TaggedItem.content_object, id='contenttypes.E001', ) diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py index 8fedacec22..3afab467a1 100644 --- a/tests/decorators/tests.py +++ b/tests/decorators/tests.py @@ -384,10 +384,10 @@ class MethodDecoratorTests(SimpleTestCase): """ msg = ( "The keyword argument `name` must be the name of a method of the " - "decorated class: . Got 'non_existing_method' instead" + "decorated class: . Got 'nonexistent_method' instead" ) with self.assertRaisesMessage(ValueError, msg): - @method_decorator(lambda: None, name="non_existing_method") + @method_decorator(lambda: None, name='nonexistent_method') class Test: @classmethod def __module__(cls): diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py index baa6098b09..494832badd 100644 --- a/tests/file_storage/tests.py +++ b/tests/file_storage/tests.py @@ -44,21 +44,21 @@ class GetStorageClassTests(SimpleTestCase): get_storage_class raises an error if the requested import don't exist. """ with self.assertRaisesMessage(ImportError, "No module named 'storage'"): - get_storage_class('storage.NonExistingStorage') + get_storage_class('storage.NonexistentStorage') - def test_get_nonexisting_storage_class(self): + def test_get_nonexistent_storage_class(self): """ get_storage_class raises an error if the requested class don't exist. """ with self.assertRaises(ImportError): - get_storage_class('django.core.files.storage.NonExistingStorage') + get_storage_class('django.core.files.storage.NonexistentStorage') - def test_get_nonexisting_storage_module(self): + def test_get_nonexistent_storage_module(self): """ get_storage_class raises an error if the requested module don't exist. """ - with self.assertRaisesMessage(ImportError, "No module named 'django.core.files.non_existing_storage'"): - get_storage_class('django.core.files.non_existing_storage.NonExistingStorage') + with self.assertRaisesMessage(ImportError, "No module named 'django.core.files.nonexistent_storage'"): + get_storage_class('django.core.files.nonexistent_storage.NonexistentStorage') class FileSystemStorageTests(unittest.TestCase): diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py index a25eae18a6..fe047e9838 100644 --- a/tests/fixtures/tests.py +++ b/tests/fixtures/tests.py @@ -681,7 +681,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase): management.call_command('loaddata', 'fixture1', exclude=['fixtures.FooModel'], verbosity=0) -class NonExistentFixtureTests(TestCase): +class NonexistentFixtureTests(TestCase): """ Custom class to limit fixture dirs. """ diff --git a/tests/fixtures_regress/fixtures/sequence_extra.json b/tests/fixtures_regress/fixtures/sequence_extra.json index d668ef6143..880aff8c24 100644 --- a/tests/fixtures_regress/fixtures/sequence_extra.json +++ b/tests/fixtures_regress/fixtures/sequence_extra.json @@ -14,7 +14,7 @@ "pk": "1", "model": "fixtures_regress.animal_extra", "fields": { - "name": "Non-existent model", + "name": "Nonexistent model", "extra_name": "test for ticket #21799", "latin_name": "Panthera leo", "count": 3, diff --git a/tests/flatpages_tests/test_csrf.py b/tests/flatpages_tests/test_csrf.py index aa0344a930..ae2dd9755f 100644 --- a/tests/flatpages_tests/test_csrf.py +++ b/tests/flatpages_tests/test_csrf.py @@ -60,7 +60,10 @@ class FlatpageCSRFTests(TestCase): self.assertContains(response, "

Isn't it flat!

") def test_view_non_existent_flatpage(self): - "A non-existent flatpage raises 404 when served through a view, even when the middleware is in use" + """ + A nonexistent flatpage raises 404 when served through a view, even when + the middleware is in use. + """ response = self.client.get('/flatpage_root/no_such_flatpage/') self.assertEqual(response.status_code, 404) @@ -79,7 +82,10 @@ class FlatpageCSRFTests(TestCase): self.assertContains(response, "

Isn't it flat!

") def test_fallback_non_existent_flatpage(self): - "A non-existent flatpage raises a 404 when served by the fallback middleware" + """ + A nonexistent flatpage raises a 404 when served by the fallback + middleware. + """ response = self.client.get('/no_such_flatpage/') self.assertEqual(response.status_code, 404) diff --git a/tests/flatpages_tests/test_middleware.py b/tests/flatpages_tests/test_middleware.py index b7ca196db1..22e4c2ba31 100644 --- a/tests/flatpages_tests/test_middleware.py +++ b/tests/flatpages_tests/test_middleware.py @@ -60,7 +60,10 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase): self.assertContains(response, "

Isn't it flat!

") def test_view_non_existent_flatpage(self): - "A non-existent flatpage raises 404 when served through a view, even when the middleware is in use" + """ + A nonexistent flatpage raises 404 when served through a view, even when + the middleware is in use. + """ response = self.client.get('/flatpage_root/no_such_flatpage/') self.assertEqual(response.status_code, 404) @@ -79,7 +82,10 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase): self.assertContains(response, "

Isn't it flat!

") def test_fallback_non_existent_flatpage(self): - "A non-existent flatpage raises a 404 when served by the fallback middleware" + """ + A nonexistent flatpage raises a 404 when served by the fallback + middleware. + """ response = self.client.get('/no_such_flatpage/') self.assertEqual(response.status_code, 404) @@ -131,7 +137,10 @@ class FlatpageMiddlewareAppendSlashTests(TestDataMixin, TestCase): self.assertRedirects(response, '/flatpage_root/flatpage/', status_code=301) def test_redirect_view_non_existent_flatpage(self): - "A non-existent flatpage raises 404 when served through a view and should not add a slash" + """ + A nonexistent flatpage raises 404 when served through a view and + should not add a slash. + """ response = self.client.get('/flatpage_root/no_such_flatpage') self.assertEqual(response.status_code, 404) @@ -141,7 +150,10 @@ class FlatpageMiddlewareAppendSlashTests(TestDataMixin, TestCase): self.assertRedirects(response, '/flatpage/', status_code=301) def test_redirect_fallback_non_existent_flatpage(self): - "A non-existent flatpage raises a 404 when served by the fallback middleware and should not add a slash" + """ + A nonexistent flatpage raises a 404 when served by the fallback + middleware and should not add a slash. + """ response = self.client.get('/no_such_flatpage') self.assertEqual(response.status_code, 404) diff --git a/tests/flatpages_tests/test_views.py b/tests/flatpages_tests/test_views.py index 42d3e2e8cc..57b05debb4 100644 --- a/tests/flatpages_tests/test_views.py +++ b/tests/flatpages_tests/test_views.py @@ -60,7 +60,7 @@ class FlatpageViewTests(TestDataMixin, TestCase): self.assertContains(response, "

Isn't it flat!

") def test_view_non_existent_flatpage(self): - "A non-existent flatpage raises 404 when served through a view" + """A nonexistent flatpage raises 404 when served through a view.""" response = self.client.get('/flatpage_root/no_such_flatpage/') self.assertEqual(response.status_code, 404) @@ -79,7 +79,10 @@ class FlatpageViewTests(TestDataMixin, TestCase): self.assertEqual(response.status_code, 404) def test_fallback_non_existent_flatpage(self): - "A non-existent flatpage won't be served if the fallback middleware is disabled" + """ + A nonexistent flatpage won't be served if the fallback middleware is + disabled. + """ response = self.client.get('/no_such_flatpage/') self.assertEqual(response.status_code, 404) @@ -122,7 +125,10 @@ class FlatpageViewAppendSlashTests(TestDataMixin, TestCase): self.assertRedirects(response, '/flatpage_root/flatpage/', status_code=301) def test_redirect_view_non_existent_flatpage(self): - "A non-existent flatpage raises 404 when served through a view and should not add a slash" + """ + A nonexistent flatpage raises 404 when served through a view and + should not add a slash. + """ response = self.client.get('/flatpage_root/no_such_flatpage') self.assertEqual(response.status_code, 404) @@ -132,7 +138,10 @@ class FlatpageViewAppendSlashTests(TestDataMixin, TestCase): self.assertEqual(response.status_code, 404) def test_redirect_fallback_non_existent_flatpage(self): - "A non-existent flatpage won't be served if the fallback middleware is disabled and should not add a slash" + """ + A nonexistent flatpage won't be served if the fallback middleware is + disabled and should not add a slash. + """ response = self.client.get('/no_such_flatpage') self.assertEqual(response.status_code, 404) diff --git a/tests/i18n/patterns/tests.py b/tests/i18n/patterns/tests.py index 35b879d11a..7637362254 100644 --- a/tests/i18n/patterns/tests.py +++ b/tests/i18n/patterns/tests.py @@ -150,7 +150,7 @@ class URLTranslationTests(URLTestCaseBase): def test_translate_url_utility(self): with translation.override('en'): - self.assertEqual(translate_url('/en/non-existent/', 'nl'), '/en/non-existent/') + self.assertEqual(translate_url('/en/nonexistent/', 'nl'), '/en/nonexistent/') self.assertEqual(translate_url('/en/users/', 'nl'), '/nl/gebruikers/') # Namespaced URL self.assertEqual(translate_url('/en/account/register/', 'nl'), '/nl/profiel/registeren/') diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py index d35f9aa063..77d180d791 100644 --- a/tests/invalid_models_tests/test_models.py +++ b/tests/invalid_models_tests/test_models.py @@ -88,7 +88,7 @@ class IndexTogetherTests(SimpleTestCase): errors = Model.check() expected = [ Error( - "'index_together' refers to the non-existent field 'missing_field'.", + "'index_together' refers to the nonexistent field 'missing_field'.", obj=Model, id='models.E012', ), @@ -214,7 +214,7 @@ class UniqueTogetherTests(SimpleTestCase): errors = Model.check() expected = [ Error( - "'unique_together' refers to the non-existent field 'missing_field'.", + "'unique_together' refers to the nonexistent field 'missing_field'.", obj=Model, id='models.E012', ), @@ -631,7 +631,7 @@ class OtherModelTests(SimpleTestCase): errors = Model.check() expected = [ Error( - "'ordering' refers to the non-existent field 'relation'.", + "'ordering' refers to the nonexistent field 'relation'.", obj=Model, id='models.E015', ), @@ -646,7 +646,7 @@ class OtherModelTests(SimpleTestCase): errors = Model.check() expected = [ Error( - "'ordering' refers to the non-existent field 'missing_field'.", + "'ordering' refers to the nonexistent field 'missing_field'.", obj=Model, id='models.E015', ) @@ -665,7 +665,7 @@ class OtherModelTests(SimpleTestCase): errors = Model.check() expected = [ Error( - "'ordering' refers to the non-existent field 'missing_fk_field_id'.", + "'ordering' refers to the nonexistent field 'missing_fk_field_id'.", obj=Model, id='models.E015', ) diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py index 1da7084e48..f826a480a1 100644 --- a/tests/lookup/tests.py +++ b/tests/lookup/tests.py @@ -252,7 +252,7 @@ class LookupTests(TestCase): ], ) # However, an exception FieldDoesNotExist will be thrown if you specify - # a non-existent field name in values() (a field that is neither in the + # a nonexistent field name in values() (a field that is neither in the # model nor in extra(select)). with self.assertRaises(FieldError): Article.objects.extra(select={'id_plus_one': 'id + 1'}).values('id', 'id_plus_two') diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index af83eb0a6a..699a3e994a 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -772,9 +772,7 @@ class MakeMigrationsTests(MigrationTestBase): self.assertIn("No conflicts detected to merge.", out.getvalue()) def test_makemigrations_no_app_sys_exit(self): - """ - makemigrations exits if a non-existent app is specified. - """ + """makemigrations exits if a nonexistent app is specified.""" err = io.StringIO() with self.assertRaises(SystemExit): call_command("makemigrations", "this_app_does_not_exist", stderr=err) diff --git a/tests/migrations/test_loader.py b/tests/migrations/test_loader.py index b06ff8f89c..61b1643506 100644 --- a/tests/migrations/test_loader.py +++ b/tests/migrations/test_loader.py @@ -351,7 +351,7 @@ class LoaderTests(TestCase): loader.build_graph() self.assertEqual(num_nodes(), 3) - # However, starting at 3 or 4 we'd need to use non-existing migrations + # However, starting at 3 or 4, nonexistent migrations would be needed. msg = ("Migration migrations.6_auto depends on nonexistent node ('migrations', '5_auto'). " "Django tried to replace migration migrations.5_auto with any of " "[migrations.3_squashed_5] but wasn't able to because some of the replaced " diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 8fe2af644f..d6e726d4d3 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -2827,13 +2827,13 @@ class EmptyStringsAsNullTest(TestCase): def test_direct_exclude(self): self.assertQuerysetEqual( - NamedCategory.objects.exclude(name__in=['nonexisting']), + NamedCategory.objects.exclude(name__in=['nonexistent']), [self.nc.pk], attrgetter('pk') ) def test_joined_exclude(self): self.assertQuerysetEqual( - DumbCategory.objects.exclude(namedcategory__name__in=['nonexisting']), + DumbCategory.objects.exclude(namedcategory__name__in=['nonexistent']), [self.nc.pk], attrgetter('pk') ) diff --git a/tests/template_backends/test_dummy.py b/tests/template_backends/test_dummy.py index 5e1639cd80..92861c24da 100644 --- a/tests/template_backends/test_dummy.py +++ b/tests/template_backends/test_dummy.py @@ -37,9 +37,9 @@ class TemplateStringsTests(SimpleTestCase): content = template.render({'name': 'world'}) self.assertEqual(content, "Hello world!\n") - def test_get_template_non_existing(self): + def test_get_template_nonexistent(self): with self.assertRaises(TemplateDoesNotExist) as e: - self.engine.get_template('template_backends/non_existing.html') + self.engine.get_template('template_backends/nonexistent.html') self.assertEqual(e.exception.backend, self.engine) def test_get_template_syntax_error(self): diff --git a/tests/template_tests/syntax_tests/test_if.py b/tests/template_tests/syntax_tests/test_if.py index 40593c7694..5ea57bf489 100644 --- a/tests/template_tests/syntax_tests/test_if.py +++ b/tests/template_tests/syntax_tests/test_if.py @@ -533,9 +533,7 @@ class IfTagTests(SimpleTestCase): @setup({'if-tag-badarg01': '{% if x|default_if_none:y %}yes{% endif %}'}) def test_if_tag_badarg01(self): - """ - Non-existent args - """ + """Nonexistent args""" output = self.engine.render_to_string('if-tag-badarg01') self.assertEqual(output, '') diff --git a/tests/template_tests/templates/included_content.html b/tests/template_tests/templates/included_content.html index bfc87c0425..cc033bd3b9 100644 --- a/tests/template_tests/templates/included_content.html +++ b/tests/template_tests/templates/included_content.html @@ -7,5 +7,5 @@ {% block error_here %} error here - {% url "non_existing_url" %} + {% url "nonexistent_url" %} {% endblock %} diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py index e5f9eb97b9..e4fd2bb8fe 100644 --- a/tests/test_client_regress/tests.py +++ b/tests/test_client_regress/tests.py @@ -391,7 +391,7 @@ class AssertRedirectsTests(SimpleTestCase): self.assertEqual(response.redirect_chain[2], ('/no_template_view/', 302)) def test_redirect_chain_to_non_existent(self): - "You can follow a chain to a non-existent view" + "You can follow a chain to a nonexistent view." response = self.client.get('/redirect_to_non_existent_view2/', {}, follow=True) self.assertRedirects(response, '/non_existent_view/', status_code=302, target_status_code=404) diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 2de8122135..b6d3751489 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -147,7 +147,7 @@ class ManageCommandTests(unittest.TestCase): def test_bad_test_runner(self): with self.assertRaises(AttributeError): - call_command('test', 'sites', testrunner='test_runner.NonExistentRunner') + call_command('test', 'sites', testrunner='test_runner.NonexistentRunner') class CustomTestRunnerOptionsTests(AdminScriptTestCase): diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py index 8d4cedc2e7..c4c1c9775d 100644 --- a/tests/urlpatterns_reverse/tests.py +++ b/tests/urlpatterns_reverse/tests.py @@ -337,11 +337,11 @@ class URLPatternReverse(SimpleTestCase): def test_view_not_found_message(self): msg = ( - "Reverse for 'non-existent-view' not found. 'non-existent-view' " + "Reverse for 'nonexistent-view' not found. 'nonexistent-view' " "is not a valid view function or pattern name." ) with self.assertRaisesMessage(NoReverseMatch, msg): - reverse('non-existent-view') + reverse('nonexistent-view') def test_no_args_message(self): msg = "Reverse for 'places' with no arguments not found. 1 pattern(s) tried:" @@ -410,8 +410,8 @@ class ResolverTests(SimpleTestCase): """ urls = 'urlpatterns_reverse.named_urls' # this list matches the expected URL types and names returned when - # you try to resolve a non-existent URL in the first level of included - # URLs in named_urls.py (e.g., '/included/non-existent-url') + # you try to resolve a nonexistent URL in the first level of included + # URLs in named_urls.py (e.g., '/included/nonexistent-url') url_types_names = [ [{'type': RegexURLPattern, 'name': 'named-url1'}], [{'type': RegexURLPattern, 'name': 'named-url2'}], @@ -422,7 +422,7 @@ class ResolverTests(SimpleTestCase): [{'type': RegexURLResolver}, {'type': RegexURLResolver}], ] with self.assertRaisesMessage(Resolver404, 'tried') as cm: - resolve('/included/non-existent-url', urlconf=urls) + resolve('/included/nonexistent-url', urlconf=urls) e = cm.exception # make sure we at least matched the root ('/') url resolver: self.assertIn('tried', e.args[0]) @@ -594,7 +594,7 @@ class NamespaceTests(SimpleTestCase): reverse('inner-nothing', kwargs={'arg1': 42, 'arg2': 37}) def test_non_existent_namespace(self): - "Non-existent namespaces raise errors" + "Nonexistent namespaces raise errors" with self.assertRaises(NoReverseMatch): reverse('blahblah:urlobject-view') with self.assertRaises(NoReverseMatch): @@ -804,20 +804,20 @@ class NamespaceTests(SimpleTestCase): "current_app should either match the whole path or shouldn't be used" self.assertEqual( '/ns-included1/test4/inner/', - reverse('inc-ns1:testapp:urlobject-view', current_app='non-existent:test-ns3') + reverse('inc-ns1:testapp:urlobject-view', current_app='nonexistent:test-ns3') ) self.assertEqual( '/ns-included1/test4/inner/37/42/', - reverse('inc-ns1:testapp:urlobject-view', args=[37, 42], current_app='non-existent:test-ns3') + reverse('inc-ns1:testapp:urlobject-view', args=[37, 42], current_app='nonexistent:test-ns3') ) self.assertEqual( '/ns-included1/test4/inner/42/37/', reverse('inc-ns1:testapp:urlobject-view', kwargs={'arg1': 42, 'arg2': 37}, - current_app='non-existent:test-ns3') + current_app='nonexistent:test-ns3') ) self.assertEqual( '/ns-included1/test4/inner/+%5C$*/', - reverse('inc-ns1:testapp:urlobject-special-view', current_app='non-existent:test-ns3') + reverse('inc-ns1:testapp:urlobject-special-view', current_app='nonexistent:test-ns3') ) diff --git a/tests/view_tests/tests/test_defaults.py b/tests/view_tests/tests/test_defaults.py index 4b002f3632..62c3fc7619 100644 --- a/tests/view_tests/tests/test_defaults.py +++ b/tests/view_tests/tests/test_defaults.py @@ -15,8 +15,10 @@ from ..models import Article, Author, UrlArticle @override_settings(ROOT_URLCONF='view_tests.urls') class DefaultsTests(TestCase): """Test django views in django/views/defaults.py""" - non_existing_urls = ['/non_existing_url/', # this is in urls.py - '/other_non_existing_url/'] # this NOT in urls.py + nonexistent_urls = [ + '/nonexistent_url/', # this is in urls.py + '/other_nonexistent_url/', # this NOT in urls.py + ] @classmethod def setUpTestData(cls): @@ -41,7 +43,7 @@ class DefaultsTests(TestCase): def test_page_not_found(self): "A 404 status is returned by the page_not_found view" - for url in self.non_existing_urls: + for url in self.nonexistent_urls: response = self.client.get(url) self.assertEqual(response.status_code, 404) @@ -60,7 +62,7 @@ class DefaultsTests(TestCase): The 404 page should have the csrf_token available in the context """ # See ticket #14565 - for url in self.non_existing_urls: + for url in self.nonexistent_urls: response = self.client.get(url) self.assertNotEqual(response.content, 'NOTPROVIDED') self.assertNotEqual(response.content, '') @@ -113,7 +115,7 @@ class DefaultsTests(TestCase): response = self.client.get('/raises403/') self.assertEqual(response['Content-Type'], 'text/html') - response = self.client.get('/non_existing_url/') + response = self.client.get('/nonexistent_url/') self.assertEqual(response['Content-Type'], 'text/html') response = self.client.get('/server_error/') diff --git a/tests/view_tests/tests/test_static.py b/tests/view_tests/tests/test_static.py index 01b4c2de7d..f7e5604d06 100644 --- a/tests/view_tests/tests/test_static.py +++ b/tests/view_tests/tests/test_static.py @@ -104,7 +104,7 @@ class StaticTests(SimpleTestCase): self.assertEqual(len(response_content), int(response['Content-Length'])) def test_404(self): - response = self.client.get('/%s/non_existing_resource' % self.prefix) + response = self.client.get('/%s/nonexistent_resource' % self.prefix) self.assertEqual(404, response.status_code) def test_index(self): diff --git a/tests/view_tests/urls.py b/tests/view_tests/urls.py index c046336b7f..26130f37bb 100644 --- a/tests/view_tests/urls.py +++ b/tests/view_tests/urls.py @@ -56,7 +56,7 @@ urlpatterns = [ url(r'^$', views.index_page), # Default views - url(r'^non_existing_url/', partial(defaults.page_not_found, exception=None)), + url(r'^nonexistent_url/', partial(defaults.page_not_found, exception=None)), url(r'^server_error/', defaults.server_error), # a view that raises an exception for the debug view