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: try:
field = model._meta.get_field(part) field = model._meta.get_field(part)
except FieldDoesNotExist: except FieldDoesNotExist:
# Lookups on non-existent fields are ok, since they're ignored # Lookups on nonexistent fields are ok, since they're ignored
# later. # later.
break break
# It is allowed to filter on values that would be found from local # 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) user = UserModel._default_manager.get_by_natural_key(username)
except UserModel.DoesNotExist: except UserModel.DoesNotExist:
# Run the default password hasher once to reduce the timing # 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) UserModel().set_password(password)
else: else:
if user.check_password(password) and self.user_can_authenticate(user): if user.check_password(password) and self.user_can_authenticate(user):

View File

@ -97,7 +97,8 @@ class GenericForeignKey:
except FieldDoesNotExist: except FieldDoesNotExist:
return [ return [
checks.Error( 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, obj=self,
id='contenttypes.E001', id='contenttypes.E001',
) )
@ -115,7 +116,8 @@ class GenericForeignKey:
except FieldDoesNotExist: except FieldDoesNotExist:
return [ return [
checks.Error( 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 self.model._meta.object_name, self.ct_field
), ),
obj=self, obj=self,

View File

@ -108,7 +108,7 @@ class BaseMemcachedCache(BaseCache):
try: try:
val = self._cache.incr(key, delta) 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 # raising a ValueError, pylibmc by raising a pylibmc.NotFound
# and Cmemcache returns None. In all cases, # and Cmemcache returns None. In all cases,
# we should raise a ValueError though. # we should raise a ValueError though.
@ -126,7 +126,7 @@ class BaseMemcachedCache(BaseCache):
try: try:
val = self._cache.decr(key, delta) 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 # raising a ValueError, pylibmc by raising a pylibmc.NotFound
# and Cmemcache returns None. In all cases, # and Cmemcache returns None. In all cases,
# we should raise a ValueError though. # we should raise a ValueError though.

View File

@ -1497,7 +1497,7 @@ class Model(metaclass=ModelBase):
except KeyError: except KeyError:
errors.append( errors.append(
checks.Error( checks.Error(
"'%s' refers to the non-existent field '%s'." % ( "'%s' refers to the nonexistent field '%s'." % (
option, field_name, option, field_name,
), ),
obj=cls, obj=cls,
@ -1570,7 +1570,7 @@ class Model(metaclass=ModelBase):
# but is an alias and therefore won't be found by opts.get_field. # but is an alias and therefore won't be found by opts.get_field.
fields = {f for f in fields if f != 'pk'} 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 = [] invalid_fields = []
# Any field name that is not present in field_names does not exist. # 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: for invalid_field in invalid_fields:
errors.append( errors.append(
checks.Error( checks.Error(
"'ordering' refers to the non-existent field '%s'." % invalid_field, "'ordering' refers to the nonexistent field '%s'." % invalid_field,
obj=cls, obj=cls,
id='models.E015', id='models.E015',
) )

View File

@ -1267,7 +1267,7 @@ class RawQuerySet:
index = columns.index(query_name) index = columns.index(query_name)
columns[index] = model_name columns[index] = model_name
except ValueError: except ValueError:
# Ignore translations for non-existent column names # Ignore translations for nonexistent column names
pass pass
return columns 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 Inconsistent row counts may be caused by missing foreign key values or a
foreign key field incorrectly set to :attr:`null=False foreign key field incorrectly set to :attr:`null=False
<django.db.models.Field.null>`. If you have a record with a <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 that foreign key is included is
:attr:`~django.contrib.admin.ModelAdmin.list_display`, the record will not be :attr:`~django.contrib.admin.ModelAdmin.list_display`, the record will not be
shown in the admin changelist because the Django model is declaring an 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.E010**: ``unique_together`` must be a list or tuple.
* **models.E011**: All ``unique_together`` elements must be lists or tuples. * **models.E011**: All ``unique_together`` elements must be lists or tuples.
* **models.E012**: ``index_together/unique_together`` refers to the * **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 * **models.E013**: ``index_together/unique_together`` refers to a
``ManyToManyField`` ``<field name>``, but ``ManyToManyField``\s are not ``ManyToManyField`` ``<field name>``, but ``ManyToManyField``\s are not
supported for that option. supported for that option.
* **models.E014**: ``ordering`` must be a tuple or list (even if you want to * **models.E014**: ``ordering`` must be a tuple or list (even if you want to
order by only one field). order by only one field).
* **models.E015**: ``ordering`` refers to the non-existent field * **models.E015**: ``ordering`` refers to the nonexistent field
``<field name>``. ``<field name>``.
* **models.E016**: ``index_together/unique_together`` refers to field * **models.E016**: ``index_together/unique_together`` refers to field
``<field_name>`` which is not local to model ``<model>``. ``<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`: :class:`~django.contrib.contenttypes.fields.GenericRelation`:
* **contenttypes.E001**: The ``GenericForeignKey`` object ID references the * **contenttypes.E001**: The ``GenericForeignKey`` object ID references the
non-existent field ``<field>``. nonexistent field ``<field>``.
* **contenttypes.E002**: The ``GenericForeignKey`` content type references the * **contenttypes.E002**: The ``GenericForeignKey`` content type references the
non-existent field ``<field>``. nonexistent field ``<field>``.
* **contenttypes.E003**: ``<field>`` is not a ``ForeignKey``. * **contenttypes.E003**: ``<field>`` is not a ``ForeignKey``.
* **contenttypes.E004**: ``<field>`` is not a ``ForeignKey`` to * **contenttypes.E004**: ``<field>`` is not a ``ForeignKey`` to
``contenttypes.ContentType``. ``contenttypes.ContentType``.

View File

@ -323,10 +323,10 @@ Methods
'Tony' 'Tony'
>>> request.get_signed_cookie('name', salt='name-salt') >>> request.get_signed_cookie('name', salt='name-salt')
'Tony' # assuming cookie was set using the same 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' KeyError: 'nonexistent-cookie'
>>> request.get_signed_cookie('non-existing-cookie', False) >>> request.get_signed_cookie('nonexistent-cookie', False)
False False
>>> request.get_signed_cookie('cookie-that-was-tampered-with') >>> 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'. idea to turn it on as a 'development default'.
Many templates, including those in the Admin site, rely upon the silence 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 assign a value other than ``''`` to ``string_if_invalid``, you will
experience rendering problems with these templates and sites. 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 ``value`` aware during a DST transition such that the time never occurred
(when entering into DST). Setting ``is_dst`` to ``True`` or ``False`` will (when entering into DST). Setting ``is_dst`` to ``True`` or ``False`` will
avoid the exception by moving the hour backwards or forwards by 1 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. time of 2:30 to 1:30 and ``is_dst=False`` would change the time to 3:30.
.. function:: make_naive(value, timezone=None) .. 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 similar commands against an existing database may generate SQL with
the new form of constraint name, while the database itself contains the new form of constraint name, while the database itself contains
constraints named in the old form; this will cause the database server 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: 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) self.assertEqual(errors, expected)
def test_generic_inline_model_admin_bad_ct_field(self): 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): class InfluenceInline(GenericStackedInline):
model = Influence model = Influence
ct_field = 'nonexistent' ct_field = 'nonexistent'
@ -363,7 +366,10 @@ class SystemChecksTestCase(SimpleTestCase):
self.assertEqual(errors, expected) self.assertEqual(errors, expected)
def test_generic_inline_model_admin_bad_fk_field(self): 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): class InfluenceInline(GenericStackedInline):
model = Influence model = Influence
ct_fk_field = 'nonexistent' ct_fk_field = 'nonexistent'
@ -428,18 +434,15 @@ class SystemChecksTestCase(SimpleTestCase):
self.assertEqual(errors, expected) self.assertEqual(errors, expected)
def test_app_label_in_admin_checks(self): def test_app_label_in_admin_checks(self):
""" class RawIdNonexistentAdmin(admin.ModelAdmin):
Regression test for #15669 - Include app label in admin system check messages raw_id_fields = ('nonexistent',)
"""
class RawIdNonexistingAdmin(admin.ModelAdmin):
raw_id_fields = ('nonexisting',)
errors = RawIdNonexistingAdmin(Album, AdminSite()).check() errors = RawIdNonexistentAdmin(Album, AdminSite()).check()
expected = [ expected = [
checks.Error( 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'.", "which is not an attribute of 'admin_checks.Album'.",
obj=RawIdNonexistingAdmin, obj=RawIdNonexistentAdmin,
id='admin.E002', id='admin.E002',
) )
] ]

View File

@ -1132,9 +1132,7 @@ class ManageCheck(AdminScriptTestCase):
self.remove_settings('settings.py') self.remove_settings('settings.py')
def test_nonexistent_app(self): def test_nonexistent_app(self):
""" manage.py check reports an error on a non-existent app in """check reports an error on a nonexistent app in INSTALLED_APPS."""
INSTALLED_APPS """
self.write_settings( self.write_settings(
'settings.py', 'settings.py',
apps=['admin_scriptz.broken_app'], apps=['admin_scriptz.broken_app'],

View File

@ -150,14 +150,14 @@ class LogEntryTests(TestCase):
def test_logentry_get_admin_url(self): def test_logentry_get_admin_url(self):
""" """
LogEntry.get_admin_url returns a URL to edit the entry's object or 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') logentry = LogEntry.objects.get(content_type__model__iexact='article')
expected_url = reverse('admin:admin_utils_article_change', args=(quote(self.a1.pk),)) expected_url = reverse('admin:admin_utils_article_change', args=(quote(self.a1.pk),))
self.assertEqual(logentry.get_admin_url(), expected_url) self.assertEqual(logentry.get_admin_url(), expected_url)
self.assertIn('article/%d/change/' % self.a1.pk, logentry.get_admin_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()) self.assertIsNone(logentry.get_admin_url())
def test_logentry_unicode(self): def test_logentry_unicode(self):

View File

@ -222,7 +222,7 @@ class AdminForeignKeyRawIdWidget(TestDataMixin, TestCase):
post_data = { post_data = {
"main_band": '%s' % pk, "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. # should result in an error message, not a server exception.
response = self.client.post(reverse('admin:admin_widgets_event_add'), post_data) 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.') 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' in perms %}Has auth permissions{% endif %}
{% if 'auth.add_permission' in perms %}Has auth.add_permission permissions{% endif %} {% if 'auth.add_permission' in perms %}Has auth.add_permission permissions{% endif %}
{% if 'nonexisting' in perms %}nonexisting perm found{% endif %} {% if 'nonexistent' in perms %}nonexistent perm found{% endif %}
{% if 'auth.nonexisting' in perms %}auth.nonexisting 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 %}Has auth permissions{% endif %}
{% if perms.auth.add_permission %}Has auth.add_permission permissions{% endif %} {% if perms.auth.add_permission %}Has auth.add_permission permissions{% endif %}
{% if perms.nonexisting %}nonexisting perm found{% endif %} {% if perms.nonexistent %}nonexistent perm found{% endif %}
{% if perms.auth.nonexisting in perms %}auth.nonexisting 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()) perms = PermWrapper(MockUser())
# Works for modules and full permissions. # Works for modules and full permissions.
self.assertIn('mockapp', perms) self.assertIn('mockapp', perms)
self.assertNotIn('nonexisting', perms) self.assertNotIn('nonexistent', perms)
self.assertIn('mockapp.someperm', perms) self.assertIn('mockapp.someperm', perms)
self.assertNotIn('mockapp.nonexisting', perms) self.assertNotIn('mockapp.nonexistent', perms)
def test_permlookupdict_in(self): def test_permlookupdict_in(self):
""" """
@ -95,7 +95,7 @@ class AuthContextProcessorTests(TestCase):
response = self.client.get('/auth_processor_perms/') response = self.client.get('/auth_processor_perms/')
self.assertContains(response, "Has auth permissions") self.assertContains(response, "Has auth permissions")
self.assertContains(response, "Has auth.add_permission permissions") self.assertContains(response, "Has auth.add_permission permissions")
self.assertNotContains(response, "nonexisting") self.assertNotContains(response, "nonexistent")
def test_perm_in_perms_attrs(self): def test_perm_in_perms_attrs(self):
u = User.objects.create_user(username='normal', password='secret') 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/') response = self.client.get('/auth_processor_perm_in_perms/')
self.assertContains(response, "Has auth permissions") self.assertContains(response, "Has auth permissions")
self.assertContains(response, "Has auth.add_permission permissions") self.assertContains(response, "Has auth.add_permission permissions")
self.assertNotContains(response, "nonexisting") self.assertNotContains(response, "nonexistent")
def test_message_attrs(self): def test_message_attrs(self):
self.client.force_login(self.superuser) self.client.force_login(self.superuser)

View File

@ -97,7 +97,7 @@ class PermissionsRequiredDecoratorTest(TestCase):
def test_permissioned_denied_redirect(self): 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): def a_view(request):
return HttpResponse() return HttpResponse()
request = self.factory.get('/rand') request = self.factory.get('/rand')
@ -108,7 +108,7 @@ class PermissionsRequiredDecoratorTest(TestCase):
def test_permissioned_denied_exception_raised(self): def test_permissioned_denied_exception_raised(self):
@permission_required([ @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) ], raise_exception=True)
def a_view(request): def a_view(request):
return HttpResponse() return HttpResponse()

View File

@ -191,7 +191,7 @@ class PasswordResetTest(AuthViewsTestCase):
self.assertContains(response, "The password reset link was invalid") self.assertContains(response, "The password reset link was invalid")
def test_confirm_invalid_user(self): 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/') response = self.client.get('/reset/123456/1-1/')
self.assertContains(response, "The password reset link was invalid") self.assertContains(response, "The password reset link was invalid")

View File

@ -238,7 +238,7 @@ class PermissionsRequiredMixinTests(TestCase):
def test_permissioned_denied_redirect(self): def test_permissioned_denied_redirect(self):
class AView(PermissionRequiredMixin, EmptyResponseView): class AView(PermissionRequiredMixin, EmptyResponseView):
permission_required = [ 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') request = self.factory.get('/rand')
@ -249,7 +249,7 @@ class PermissionsRequiredMixinTests(TestCase):
def test_permissioned_denied_exception_raised(self): def test_permissioned_denied_exception_raised(self):
class AView(PermissionRequiredMixin, EmptyResponseView): class AView(PermissionRequiredMixin, EmptyResponseView):
permission_required = [ 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 raise_exception = True

View File

@ -234,7 +234,7 @@ class PasswordResetTest(AuthViewsTestCase):
self.assertContains(response, "The password reset link was invalid") self.assertContains(response, "The password reset link was invalid")
def test_confirm_invalid_user(self): 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/') response = self.client.get('/reset/123456/1-1/')
self.assertContains(response, "The password reset link was invalid") self.assertContains(response, "The password reset link was invalid")

View File

@ -83,7 +83,7 @@ class DummyCacheTests(SimpleTestCase):
self.assertIsNone(cache.get("addkey1")) self.assertIsNone(cache.get("addkey1"))
def test_non_existent(self): 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.assertIsNone(cache.get("does_not_exist"))
self.assertEqual(cache.get("does_not_exist", "bang!"), "bang!") self.assertEqual(cache.get("does_not_exist", "bang!"), "bang!")
@ -280,8 +280,7 @@ class BaseCacheTests:
self.assertEqual(caches['prefix'].get('somekey'), 'value2') self.assertEqual(caches['prefix'].get('somekey'), 'value2')
def test_non_existent(self): def test_non_existent(self):
# Non-existent cache keys return as None/default """Nonexistent cache keys return as None/default."""
# get with non-existent keys
self.assertIsNone(cache.get("does_not_exist")) self.assertIsNone(cache.get("does_not_exist"))
self.assertEqual(cache.get("does_not_exist", "bang!"), "bang!") self.assertEqual(cache.get("does_not_exist", "bang!"), "bang!")

View File

@ -154,7 +154,7 @@ class GenericForeignKeyTests(SimpleTestCase):
errors = TaggedItem.content_object.check() errors = TaggedItem.content_object.check()
expected = [ expected = [
checks.Error( 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, obj=TaggedItem.content_object,
id='contenttypes.E002', id='contenttypes.E002',
) )
@ -212,7 +212,7 @@ class GenericForeignKeyTests(SimpleTestCase):
errors = TaggedItem.content_object.check() errors = TaggedItem.content_object.check()
expected = [ expected = [
checks.Error( 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, obj=TaggedItem.content_object,
id='contenttypes.E001', id='contenttypes.E001',
) )

View File

@ -384,10 +384,10 @@ class MethodDecoratorTests(SimpleTestCase):
""" """
msg = ( msg = (
"The keyword argument `name` must be the name of a method of the " "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): with self.assertRaisesMessage(ValueError, msg):
@method_decorator(lambda: None, name="non_existing_method") @method_decorator(lambda: None, name='nonexistent_method')
class Test: class Test:
@classmethod @classmethod
def __module__(cls): 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. get_storage_class raises an error if the requested import don't exist.
""" """
with self.assertRaisesMessage(ImportError, "No module named 'storage'"): 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. get_storage_class raises an error if the requested class don't exist.
""" """
with self.assertRaises(ImportError): 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. 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'"): with self.assertRaisesMessage(ImportError, "No module named 'django.core.files.nonexistent_storage'"):
get_storage_class('django.core.files.non_existing_storage.NonExistingStorage') get_storage_class('django.core.files.nonexistent_storage.NonexistentStorage')
class FileSystemStorageTests(unittest.TestCase): class FileSystemStorageTests(unittest.TestCase):

View File

@ -681,7 +681,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
management.call_command('loaddata', 'fixture1', exclude=['fixtures.FooModel'], verbosity=0) management.call_command('loaddata', 'fixture1', exclude=['fixtures.FooModel'], verbosity=0)
class NonExistentFixtureTests(TestCase): class NonexistentFixtureTests(TestCase):
""" """
Custom class to limit fixture dirs. Custom class to limit fixture dirs.
""" """

View File

@ -14,7 +14,7 @@
"pk": "1", "pk": "1",
"model": "fixtures_regress.animal_extra", "model": "fixtures_regress.animal_extra",
"fields": { "fields": {
"name": "Non-existent model", "name": "Nonexistent model",
"extra_name": "test for ticket #21799", "extra_name": "test for ticket #21799",
"latin_name": "Panthera leo", "latin_name": "Panthera leo",
"count": 3, "count": 3,

View File

@ -60,7 +60,10 @@ class FlatpageCSRFTests(TestCase):
self.assertContains(response, "<p>Isn't it flat!</p>") self.assertContains(response, "<p>Isn't it flat!</p>")
def test_view_non_existent_flatpage(self): 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/') response = self.client.get('/flatpage_root/no_such_flatpage/')
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
@ -79,7 +82,10 @@ class FlatpageCSRFTests(TestCase):
self.assertContains(response, "<p>Isn't it flat!</p>") self.assertContains(response, "<p>Isn't it flat!</p>")
def test_fallback_non_existent_flatpage(self): 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/') response = self.client.get('/no_such_flatpage/')
self.assertEqual(response.status_code, 404) 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>") self.assertContains(response, "<p>Isn't it flat!</p>")
def test_view_non_existent_flatpage(self): 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/') response = self.client.get('/flatpage_root/no_such_flatpage/')
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
@ -79,7 +82,10 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
self.assertContains(response, "<p>Isn't it flat!</p>") self.assertContains(response, "<p>Isn't it flat!</p>")
def test_fallback_non_existent_flatpage(self): 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/') response = self.client.get('/no_such_flatpage/')
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
@ -131,7 +137,10 @@ class FlatpageMiddlewareAppendSlashTests(TestDataMixin, TestCase):
self.assertRedirects(response, '/flatpage_root/flatpage/', status_code=301) self.assertRedirects(response, '/flatpage_root/flatpage/', status_code=301)
def test_redirect_view_non_existent_flatpage(self): 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') response = self.client.get('/flatpage_root/no_such_flatpage')
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
@ -141,7 +150,10 @@ class FlatpageMiddlewareAppendSlashTests(TestDataMixin, TestCase):
self.assertRedirects(response, '/flatpage/', status_code=301) self.assertRedirects(response, '/flatpage/', status_code=301)
def test_redirect_fallback_non_existent_flatpage(self): 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') response = self.client.get('/no_such_flatpage')
self.assertEqual(response.status_code, 404) 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>") self.assertContains(response, "<p>Isn't it flat!</p>")
def test_view_non_existent_flatpage(self): 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/') response = self.client.get('/flatpage_root/no_such_flatpage/')
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
@ -79,7 +79,10 @@ class FlatpageViewTests(TestDataMixin, TestCase):
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
def test_fallback_non_existent_flatpage(self): 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/') response = self.client.get('/no_such_flatpage/')
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
@ -122,7 +125,10 @@ class FlatpageViewAppendSlashTests(TestDataMixin, TestCase):
self.assertRedirects(response, '/flatpage_root/flatpage/', status_code=301) self.assertRedirects(response, '/flatpage_root/flatpage/', status_code=301)
def test_redirect_view_non_existent_flatpage(self): 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') response = self.client.get('/flatpage_root/no_such_flatpage')
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
@ -132,7 +138,10 @@ class FlatpageViewAppendSlashTests(TestDataMixin, TestCase):
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
def test_redirect_fallback_non_existent_flatpage(self): 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') response = self.client.get('/no_such_flatpage')
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)

View File

@ -150,7 +150,7 @@ class URLTranslationTests(URLTestCaseBase):
def test_translate_url_utility(self): def test_translate_url_utility(self):
with translation.override('en'): 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/') self.assertEqual(translate_url('/en/users/', 'nl'), '/nl/gebruikers/')
# Namespaced URL # Namespaced URL
self.assertEqual(translate_url('/en/account/register/', 'nl'), '/nl/profiel/registeren/') self.assertEqual(translate_url('/en/account/register/', 'nl'), '/nl/profiel/registeren/')

View File

@ -88,7 +88,7 @@ class IndexTogetherTests(SimpleTestCase):
errors = Model.check() errors = Model.check()
expected = [ expected = [
Error( Error(
"'index_together' refers to the non-existent field 'missing_field'.", "'index_together' refers to the nonexistent field 'missing_field'.",
obj=Model, obj=Model,
id='models.E012', id='models.E012',
), ),
@ -214,7 +214,7 @@ class UniqueTogetherTests(SimpleTestCase):
errors = Model.check() errors = Model.check()
expected = [ expected = [
Error( Error(
"'unique_together' refers to the non-existent field 'missing_field'.", "'unique_together' refers to the nonexistent field 'missing_field'.",
obj=Model, obj=Model,
id='models.E012', id='models.E012',
), ),
@ -631,7 +631,7 @@ class OtherModelTests(SimpleTestCase):
errors = Model.check() errors = Model.check()
expected = [ expected = [
Error( Error(
"'ordering' refers to the non-existent field 'relation'.", "'ordering' refers to the nonexistent field 'relation'.",
obj=Model, obj=Model,
id='models.E015', id='models.E015',
), ),
@ -646,7 +646,7 @@ class OtherModelTests(SimpleTestCase):
errors = Model.check() errors = Model.check()
expected = [ expected = [
Error( Error(
"'ordering' refers to the non-existent field 'missing_field'.", "'ordering' refers to the nonexistent field 'missing_field'.",
obj=Model, obj=Model,
id='models.E015', id='models.E015',
) )
@ -665,7 +665,7 @@ class OtherModelTests(SimpleTestCase):
errors = Model.check() errors = Model.check()
expected = [ expected = [
Error( Error(
"'ordering' refers to the non-existent field 'missing_fk_field_id'.", "'ordering' refers to the nonexistent field 'missing_fk_field_id'.",
obj=Model, obj=Model,
id='models.E015', id='models.E015',
) )

View File

@ -252,7 +252,7 @@ class LookupTests(TestCase):
], ],
) )
# However, an exception FieldDoesNotExist will be thrown if you specify # 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)). # model nor in extra(select)).
with self.assertRaises(FieldError): with self.assertRaises(FieldError):
Article.objects.extra(select={'id_plus_one': 'id + 1'}).values('id', 'id_plus_two') 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()) self.assertIn("No conflicts detected to merge.", out.getvalue())
def test_makemigrations_no_app_sys_exit(self): def test_makemigrations_no_app_sys_exit(self):
""" """makemigrations exits if a nonexistent app is specified."""
makemigrations exits if a non-existent app is specified.
"""
err = io.StringIO() err = io.StringIO()
with self.assertRaises(SystemExit): with self.assertRaises(SystemExit):
call_command("makemigrations", "this_app_does_not_exist", stderr=err) call_command("makemigrations", "this_app_does_not_exist", stderr=err)

View File

@ -351,7 +351,7 @@ class LoaderTests(TestCase):
loader.build_graph() loader.build_graph()
self.assertEqual(num_nodes(), 3) 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'). " msg = ("Migration migrations.6_auto depends on nonexistent node ('migrations', '5_auto'). "
"Django tried to replace migration migrations.5_auto with any of " "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 " "[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): def test_direct_exclude(self):
self.assertQuerysetEqual( self.assertQuerysetEqual(
NamedCategory.objects.exclude(name__in=['nonexisting']), NamedCategory.objects.exclude(name__in=['nonexistent']),
[self.nc.pk], attrgetter('pk') [self.nc.pk], attrgetter('pk')
) )
def test_joined_exclude(self): def test_joined_exclude(self):
self.assertQuerysetEqual( self.assertQuerysetEqual(
DumbCategory.objects.exclude(namedcategory__name__in=['nonexisting']), DumbCategory.objects.exclude(namedcategory__name__in=['nonexistent']),
[self.nc.pk], attrgetter('pk') [self.nc.pk], attrgetter('pk')
) )

View File

@ -37,9 +37,9 @@ class TemplateStringsTests(SimpleTestCase):
content = template.render({'name': 'world'}) content = template.render({'name': 'world'})
self.assertEqual(content, "Hello world!\n") 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: 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) self.assertEqual(e.exception.backend, self.engine)
def test_get_template_syntax_error(self): 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 %}'}) @setup({'if-tag-badarg01': '{% if x|default_if_none:y %}yes{% endif %}'})
def test_if_tag_badarg01(self): def test_if_tag_badarg01(self):
""" """Nonexistent args"""
Non-existent args
"""
output = self.engine.render_to_string('if-tag-badarg01') output = self.engine.render_to_string('if-tag-badarg01')
self.assertEqual(output, '') self.assertEqual(output, '')

View File

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

View File

@ -391,7 +391,7 @@ class AssertRedirectsTests(SimpleTestCase):
self.assertEqual(response.redirect_chain[2], ('/no_template_view/', 302)) self.assertEqual(response.redirect_chain[2], ('/no_template_view/', 302))
def test_redirect_chain_to_non_existent(self): 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) response = self.client.get('/redirect_to_non_existent_view2/', {}, follow=True)
self.assertRedirects(response, '/non_existent_view/', status_code=302, target_status_code=404) 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): def test_bad_test_runner(self):
with self.assertRaises(AttributeError): with self.assertRaises(AttributeError):
call_command('test', 'sites', testrunner='test_runner.NonExistentRunner') call_command('test', 'sites', testrunner='test_runner.NonexistentRunner')
class CustomTestRunnerOptionsTests(AdminScriptTestCase): class CustomTestRunnerOptionsTests(AdminScriptTestCase):

View File

@ -337,11 +337,11 @@ class URLPatternReverse(SimpleTestCase):
def test_view_not_found_message(self): def test_view_not_found_message(self):
msg = ( 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." "is not a valid view function or pattern name."
) )
with self.assertRaisesMessage(NoReverseMatch, msg): with self.assertRaisesMessage(NoReverseMatch, msg):
reverse('non-existent-view') reverse('nonexistent-view')
def test_no_args_message(self): def test_no_args_message(self):
msg = "Reverse for 'places' with no arguments not found. 1 pattern(s) tried:" 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' urls = 'urlpatterns_reverse.named_urls'
# this list matches the expected URL types and names returned when # 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 # you try to resolve a nonexistent URL in the first level of included
# URLs in named_urls.py (e.g., '/included/non-existent-url') # URLs in named_urls.py (e.g., '/included/nonexistent-url')
url_types_names = [ url_types_names = [
[{'type': RegexURLPattern, 'name': 'named-url1'}], [{'type': RegexURLPattern, 'name': 'named-url1'}],
[{'type': RegexURLPattern, 'name': 'named-url2'}], [{'type': RegexURLPattern, 'name': 'named-url2'}],
@ -422,7 +422,7 @@ class ResolverTests(SimpleTestCase):
[{'type': RegexURLResolver}, {'type': RegexURLResolver}], [{'type': RegexURLResolver}, {'type': RegexURLResolver}],
] ]
with self.assertRaisesMessage(Resolver404, 'tried') as cm: with self.assertRaisesMessage(Resolver404, 'tried') as cm:
resolve('/included/non-existent-url', urlconf=urls) resolve('/included/nonexistent-url', urlconf=urls)
e = cm.exception e = cm.exception
# make sure we at least matched the root ('/') url resolver: # make sure we at least matched the root ('/') url resolver:
self.assertIn('tried', e.args[0]) self.assertIn('tried', e.args[0])
@ -594,7 +594,7 @@ class NamespaceTests(SimpleTestCase):
reverse('inner-nothing', kwargs={'arg1': 42, 'arg2': 37}) reverse('inner-nothing', kwargs={'arg1': 42, 'arg2': 37})
def test_non_existent_namespace(self): def test_non_existent_namespace(self):
"Non-existent namespaces raise errors" "Nonexistent namespaces raise errors"
with self.assertRaises(NoReverseMatch): with self.assertRaises(NoReverseMatch):
reverse('blahblah:urlobject-view') reverse('blahblah:urlobject-view')
with self.assertRaises(NoReverseMatch): with self.assertRaises(NoReverseMatch):
@ -804,20 +804,20 @@ class NamespaceTests(SimpleTestCase):
"current_app should either match the whole path or shouldn't be used" "current_app should either match the whole path or shouldn't be used"
self.assertEqual( self.assertEqual(
'/ns-included1/test4/inner/', '/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( self.assertEqual(
'/ns-included1/test4/inner/37/42/', '/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( self.assertEqual(
'/ns-included1/test4/inner/42/37/', '/ns-included1/test4/inner/42/37/',
reverse('inc-ns1:testapp:urlobject-view', kwargs={'arg1': 42, 'arg2': 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( self.assertEqual(
'/ns-included1/test4/inner/+%5C$*/', '/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') @override_settings(ROOT_URLCONF='view_tests.urls')
class DefaultsTests(TestCase): class DefaultsTests(TestCase):
"""Test django views in django/views/defaults.py""" """Test django views in django/views/defaults.py"""
non_existing_urls = ['/non_existing_url/', # this is in urls.py nonexistent_urls = [
'/other_non_existing_url/'] # this NOT in urls.py '/nonexistent_url/', # this is in urls.py
'/other_nonexistent_url/', # this NOT in urls.py
]
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):
@ -41,7 +43,7 @@ class DefaultsTests(TestCase):
def test_page_not_found(self): def test_page_not_found(self):
"A 404 status is returned by the page_not_found view" "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) response = self.client.get(url)
self.assertEqual(response.status_code, 404) 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 The 404 page should have the csrf_token available in the context
""" """
# See ticket #14565 # See ticket #14565
for url in self.non_existing_urls: for url in self.nonexistent_urls:
response = self.client.get(url) response = self.client.get(url)
self.assertNotEqual(response.content, 'NOTPROVIDED') self.assertNotEqual(response.content, 'NOTPROVIDED')
self.assertNotEqual(response.content, '') self.assertNotEqual(response.content, '')
@ -113,7 +115,7 @@ class DefaultsTests(TestCase):
response = self.client.get('/raises403/') response = self.client.get('/raises403/')
self.assertEqual(response['Content-Type'], 'text/html') 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') self.assertEqual(response['Content-Type'], 'text/html')
response = self.client.get('/server_error/') response = self.client.get('/server_error/')

View File

@ -104,7 +104,7 @@ class StaticTests(SimpleTestCase):
self.assertEqual(len(response_content), int(response['Content-Length'])) self.assertEqual(len(response_content), int(response['Content-Length']))
def test_404(self): 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) self.assertEqual(404, response.status_code)
def test_index(self): def test_index(self):

View File

@ -56,7 +56,7 @@ urlpatterns = [
url(r'^$', views.index_page), url(r'^$', views.index_page),
# Default views # 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), url(r'^server_error/', defaults.server_error),
# a view that raises an exception for the debug view # a view that raises an exception for the debug view