Fixed spelling of "nonexistent".

This commit is contained in:
Tim Graham 2017-02-02 20:43:21 -05:00
parent a21ec12409
commit 29f607927f
47 changed files with 141 additions and 114 deletions

View File

@ -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

View File

@ -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):

View File

@ -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,

View File

@ -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.

View File

@ -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',
)

View File

@ -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

View File

@ -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
<django.db.models.Field.null>`. 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

View File

@ -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 ``<field name>``.
nonexistent field ``<field name>``.
* **models.E013**: ``index_together/unique_together`` refers to a
``ManyToManyField`` ``<field name>``, 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
``<field name>``.
* **models.E016**: ``index_together/unique_together`` refers to field
``<field_name>`` which is not local to model ``<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 ``<field>``.
nonexistent field ``<field>``.
* **contenttypes.E002**: The ``GenericForeignKey`` content type references the
non-existent field ``<field>``.
nonexistent field ``<field>``.
* **contenttypes.E003**: ``<field>`` is not a ``ForeignKey``.
* **contenttypes.E004**: ``<field>`` is not a ``ForeignKey`` to
``contenttypes.ContentType``.

View File

@ -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')
...

View File

@ -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.

View File

@ -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)

View File

@ -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:

View File

@ -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',
)
]

View File

@ -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'],

View File

@ -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):

View File

@ -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.')

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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)

View File

@ -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()

View File

@ -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")

View File

@ -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

View File

@ -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")

View File

@ -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!")

View File

@ -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',
)

View File

@ -384,10 +384,10 @@ class MethodDecoratorTests(SimpleTestCase):
"""
msg = (
"The keyword argument `name` must be the name of a method of the "
"decorated class: <class 'Test'>. Got 'non_existing_method' instead"
"decorated class: <class 'Test'>. 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):

View File

@ -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):

View File

@ -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.
"""

View File

@ -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,

View File

@ -60,7 +60,10 @@ class FlatpageCSRFTests(TestCase):
self.assertContains(response, "<p>Isn't it flat!</p>")
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, "<p>Isn't it flat!</p>")
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)

View File

@ -60,7 +60,10 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
self.assertContains(response, "<p>Isn't it flat!</p>")
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, "<p>Isn't it flat!</p>")
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)

View File

@ -60,7 +60,7 @@ class FlatpageViewTests(TestDataMixin, TestCase):
self.assertContains(response, "<p>Isn't it flat!</p>")
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)

View File

@ -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/')

View File

@ -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',
)

View File

@ -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')

View File

@ -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)

View File

@ -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 "

View File

@ -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')
)

View File

@ -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):

View File

@ -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, '')

View File

@ -7,5 +7,5 @@
{% block error_here %}
error here
{% url "non_existing_url" %}
{% url "nonexistent_url" %}
{% endblock %}

View File

@ -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)

View File

@ -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):

View File

@ -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')
)

View File

@ -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/')

View File

@ -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):

View File

@ -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