mirror of https://github.com/django/django.git
Fixed typos in code comments.
This commit is contained in:
parent
dccf41cff0
commit
039465a6a7
|
@ -269,7 +269,7 @@ class TestUtilsHashPass(SimpleTestCase):
|
||||||
def setter(password):
|
def setter(password):
|
||||||
state['upgraded'] = True
|
state['upgraded'] = True
|
||||||
|
|
||||||
# Check that no upgrade is triggerd
|
# Check that no upgrade is triggered
|
||||||
self.assertTrue(check_password('letmein', encoded, setter))
|
self.assertTrue(check_password('letmein', encoded, setter))
|
||||||
self.assertFalse(state['upgraded'])
|
self.assertFalse(state['upgraded'])
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ class TestUtilsHashPass(SimpleTestCase):
|
||||||
algo, iterations, salt, hash = encoded.split('$', 3)
|
algo, iterations, salt, hash = encoded.split('$', 3)
|
||||||
self.assertEqual(iterations, '1')
|
self.assertEqual(iterations, '1')
|
||||||
|
|
||||||
# Check that no upgrade is triggerd
|
# Check that no upgrade is triggered
|
||||||
self.assertTrue(check_password('letmein', encoded, setter))
|
self.assertTrue(check_password('letmein', encoded, setter))
|
||||||
self.assertFalse(state['upgraded'])
|
self.assertFalse(state['upgraded'])
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
|
||||||
|
|
||||||
# Anything that is either not None or the acceptable pointer type will
|
# Anything that is either not None or the acceptable pointer type will
|
||||||
# result in a TypeError when trying to assign it to the `ptr` property.
|
# result in a TypeError when trying to assign it to the `ptr` property.
|
||||||
# Thus, memmory addresses (integers) and pointers of the incorrect type
|
# Thus, memory addresses (integers) and pointers of the incorrect type
|
||||||
# (in `bad_ptrs`) will not be allowed.
|
# (in `bad_ptrs`) will not be allowed.
|
||||||
bad_ptrs = (5, ctypes.c_char_p(b'foobar'))
|
bad_ptrs = (5, ctypes.c_char_p(b'foobar'))
|
||||||
for bad_ptr in bad_ptrs:
|
for bad_ptr in bad_ptrs:
|
||||||
|
|
|
@ -83,7 +83,7 @@ class GeoRegressionTests(TestCase):
|
||||||
|
|
||||||
val1 = Truth.objects.get(pk=t1.pk).val
|
val1 = Truth.objects.get(pk=t1.pk).val
|
||||||
val2 = Truth.objects.get(pk=t2.pk).val
|
val2 = Truth.objects.get(pk=t2.pk).val
|
||||||
# verify types -- should't be 0/1
|
# verify types -- shouldn't be 0/1
|
||||||
self.assertIsInstance(val1, bool)
|
self.assertIsInstance(val1, bool)
|
||||||
self.assertIsInstance(val2, bool)
|
self.assertIsInstance(val2, bool)
|
||||||
# verify values
|
# verify values
|
||||||
|
|
|
@ -456,7 +456,7 @@ class GeoQuerySetTest(TestCase):
|
||||||
geom = Point(5, 23)
|
geom = Point(5, 23)
|
||||||
qs = Country.objects.all().difference(geom).sym_difference(geom).union(geom)
|
qs = Country.objects.all().difference(geom).sym_difference(geom).union(geom)
|
||||||
|
|
||||||
# XXX For some reason SpatiaLite does something screwey with the Texas geometry here. Also,
|
# XXX For some reason SpatiaLite does something screwy with the Texas geometry here. Also,
|
||||||
# XXX it doesn't like the null intersection.
|
# XXX it doesn't like the null intersection.
|
||||||
if spatialite:
|
if spatialite:
|
||||||
qs = qs.exclude(name='Texas')
|
qs = qs.exclude(name='Texas')
|
||||||
|
@ -599,7 +599,7 @@ class GeoQuerySetTest(TestCase):
|
||||||
@skipUnlessDBFeature("has_gml_method")
|
@skipUnlessDBFeature("has_gml_method")
|
||||||
def test_gml(self):
|
def test_gml(self):
|
||||||
"Testing GML output from the database using GeoQuerySet.gml()."
|
"Testing GML output from the database using GeoQuerySet.gml()."
|
||||||
# Should throw a TypeError when tyring to obtain GML from a
|
# Should throw a TypeError when trying to obtain GML from a
|
||||||
# non-geometry field.
|
# non-geometry field.
|
||||||
qs = City.objects.all()
|
qs = City.objects.all()
|
||||||
self.assertRaises(TypeError, qs.gml, field_name='name')
|
self.assertRaises(TypeError, qs.gml, field_name='name')
|
||||||
|
|
|
@ -112,7 +112,7 @@ class BaseDatabaseCreation(object):
|
||||||
queryset = model._default_manager.using(self.connection.alias).order_by(model._meta.pk.name)
|
queryset = model._default_manager.using(self.connection.alias).order_by(model._meta.pk.name)
|
||||||
for obj in queryset.iterator():
|
for obj in queryset.iterator():
|
||||||
yield obj
|
yield obj
|
||||||
# Serialise to a string
|
# Serialize to a string
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
serializers.serialize("json", get_objects(), indent=None, stream=out)
|
serializers.serialize("json", get_objects(), indent=None, stream=out)
|
||||||
return out.getvalue()
|
return out.getvalue()
|
||||||
|
|
|
@ -195,7 +195,7 @@ class MigrationLoader(object):
|
||||||
for key, migration in normal.items():
|
for key, migration in normal.items():
|
||||||
for parent in migration.dependencies:
|
for parent in migration.dependencies:
|
||||||
reverse_dependencies.setdefault(parent, set()).add(key)
|
reverse_dependencies.setdefault(parent, set()).add(key)
|
||||||
# Remeber the possible replacements to generate more meaningful error
|
# Remember the possible replacements to generate more meaningful error
|
||||||
# messages
|
# messages
|
||||||
reverse_replacements = {}
|
reverse_replacements = {}
|
||||||
for key, migration in replacing.items():
|
for key, migration in replacing.items():
|
||||||
|
|
|
@ -229,7 +229,7 @@ class MigrationOptimizer(object):
|
||||||
|
|
||||||
def reduce_create_model_add_field(self, operation, other, in_between):
|
def reduce_create_model_add_field(self, operation, other, in_between):
|
||||||
if operation.name_lower == other.model_name_lower:
|
if operation.name_lower == other.model_name_lower:
|
||||||
# Don't allow optimisations of FKs through models they reference
|
# Don't allow optimizations of FKs through models they reference
|
||||||
if hasattr(other.field, "rel") and other.field.rel:
|
if hasattr(other.field, "rel") and other.field.rel:
|
||||||
for between in in_between:
|
for between in in_between:
|
||||||
# Check that it doesn't point to the model
|
# Check that it doesn't point to the model
|
||||||
|
|
|
@ -538,7 +538,7 @@ def modelform_factory(model, form=ModelForm, fields=None, exclude=None,
|
||||||
"'exclude' explicitly is prohibited."
|
"'exclude' explicitly is prohibited."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Instatiate type(form) in order to use the same metaclass as form.
|
# Instantiate type(form) in order to use the same metaclass as form.
|
||||||
return type(form)(class_name, (form,), form_class_attrs)
|
return type(form)(class_name, (form,), form_class_attrs)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ def normalize(pattern):
|
||||||
else:
|
else:
|
||||||
result.append(Group((("%%(%s)s" % param), None)))
|
result.append(Group((("%%(%s)s" % param), None)))
|
||||||
elif ch in "*?+{":
|
elif ch in "*?+{":
|
||||||
# Quanitifers affect the previous item in the result list.
|
# Quantifiers affect the previous item in the result list.
|
||||||
count, ch = get_quantifier(ch, pattern_iter)
|
count, ch = get_quantifier(ch, pattern_iter)
|
||||||
if ch:
|
if ch:
|
||||||
# We had to look ahead, but it wasn't need to compute the
|
# We had to look ahead, but it wasn't need to compute the
|
||||||
|
|
|
@ -71,7 +71,7 @@ class AdminCustomUrlsTest(TestCase):
|
||||||
self.assertContains(response, 'Change action')
|
self.assertContains(response, 'Change action')
|
||||||
|
|
||||||
# Should correctly get the change_view for the model instance with the
|
# Should correctly get the change_view for the model instance with the
|
||||||
# funny-looking PK (the one wth a 'path/to/html/document.html' value)
|
# funny-looking PK (the one with a 'path/to/html/document.html' value)
|
||||||
url = reverse('admin:%s_action_change' % Action._meta.app_label,
|
url = reverse('admin:%s_action_change' % Action._meta.app_label,
|
||||||
args=(quote("path/to/html/document.html"),))
|
args=(quote("path/to/html/document.html"),))
|
||||||
response = self.client.get(url)
|
response = self.client.get(url)
|
||||||
|
|
|
@ -1788,7 +1788,7 @@ class AdminViewsNoUrlTest(TestCase):
|
||||||
self.client.get('/test_admin/admin/')
|
self.client.get('/test_admin/admin/')
|
||||||
r = self.client.post(reverse('admin:login'), self.changeuser_login)
|
r = self.client.post(reverse('admin:login'), self.changeuser_login)
|
||||||
r = self.client.get('/test_admin/admin/')
|
r = self.client.get('/test_admin/admin/')
|
||||||
# we shouldn' get an 500 error caused by a NoReverseMatch
|
# we shouldn't get a 500 error caused by a NoReverseMatch
|
||||||
self.assertEqual(r.status_code, 200)
|
self.assertEqual(r.status_code, 200)
|
||||||
self.client.get('/test_admin/admin/logout/')
|
self.client.get('/test_admin/admin/logout/')
|
||||||
|
|
||||||
|
|
|
@ -771,7 +771,7 @@ class FkConstraintsTests(TransactionTestCase):
|
||||||
models.Article.objects.create(headline='Another article',
|
models.Article.objects.create(headline='Another article',
|
||||||
pub_date=datetime.datetime(1988, 5, 15),
|
pub_date=datetime.datetime(1988, 5, 15),
|
||||||
reporter=self.r, reporter_proxy=r_proxy)
|
reporter=self.r, reporter_proxy=r_proxy)
|
||||||
# Retreive the second article from the DB
|
# Retrieve the second article from the DB
|
||||||
a2 = models.Article.objects.get(headline='Another article')
|
a2 = models.Article.objects.get(headline='Another article')
|
||||||
a2.reporter_proxy_id = 30
|
a2.reporter_proxy_id = 30
|
||||||
self.assertRaises(IntegrityError, a2.save)
|
self.assertRaises(IntegrityError, a2.save)
|
||||||
|
|
|
@ -357,7 +357,7 @@ class ModelTest(TestCase):
|
||||||
Article.objects.create(headline=lazy, pub_date=datetime.now())
|
Article.objects.create(headline=lazy, pub_date=datetime.now())
|
||||||
article = Article.objects.get()
|
article = Article.objects.get()
|
||||||
self.assertEqual(article.headline, notlazy)
|
self.assertEqual(article.headline, notlazy)
|
||||||
# test that assign + save works with Promise objecs
|
# test that assign + save works with Promise objects
|
||||||
article.headline = lazy
|
article.headline = lazy
|
||||||
article.save()
|
article.save()
|
||||||
self.assertEqual(article.headline, notlazy)
|
self.assertEqual(article.headline, notlazy)
|
||||||
|
|
|
@ -324,7 +324,7 @@ class DeletionTests(TestCase):
|
||||||
# One query for Avatar.objects.all() and then one related fast delete for
|
# One query for Avatar.objects.all() and then one related fast delete for
|
||||||
# each batch.
|
# each batch.
|
||||||
fetches_to_mem = 1 + batches
|
fetches_to_mem = 1 + batches
|
||||||
# The Avatar objecs are going to be deleted in batches of GET_ITERATOR_CHUNK_SIZE
|
# The Avatar objects are going to be deleted in batches of GET_ITERATOR_CHUNK_SIZE
|
||||||
queries = fetches_to_mem + TEST_SIZE // GET_ITERATOR_CHUNK_SIZE
|
queries = fetches_to_mem + TEST_SIZE // GET_ITERATOR_CHUNK_SIZE
|
||||||
self.assertNumQueries(queries, Avatar.objects.all().delete)
|
self.assertNumQueries(queries, Avatar.objects.all().delete)
|
||||||
self.assertFalse(Avatar.objects.exists())
|
self.assertFalse(Avatar.objects.exists())
|
||||||
|
|
|
@ -187,7 +187,7 @@ class FileUploadTests(TestCase):
|
||||||
# trying such an attack.
|
# trying such an attack.
|
||||||
scary_file_names = [
|
scary_file_names = [
|
||||||
"/tmp/hax0rd.txt", # Absolute path, *nix-style.
|
"/tmp/hax0rd.txt", # Absolute path, *nix-style.
|
||||||
"C:\\Windows\\hax0rd.txt", # Absolute path, win-syle.
|
"C:\\Windows\\hax0rd.txt", # Absolute path, win-style.
|
||||||
"C:/Windows/hax0rd.txt", # Absolute path, broken-style.
|
"C:/Windows/hax0rd.txt", # Absolute path, broken-style.
|
||||||
"\\tmp\\hax0rd.txt", # Absolute path, broken in a different way.
|
"\\tmp\\hax0rd.txt", # Absolute path, broken in a different way.
|
||||||
"/tmp\\hax0rd.txt", # Absolute path, broken by mixing.
|
"/tmp\\hax0rd.txt", # Absolute path, broken by mixing.
|
||||||
|
|
|
@ -389,7 +389,7 @@ class FormsExtraTestCase(TestCase, AssertFormErrorsMixin):
|
||||||
# MultiWidget and MultiValueField #############################################
|
# MultiWidget and MultiValueField #############################################
|
||||||
# MultiWidgets are widgets composed of other widgets. They are usually
|
# MultiWidgets are widgets composed of other widgets. They are usually
|
||||||
# combined with MultiValueFields - a field that is composed of other fields.
|
# combined with MultiValueFields - a field that is composed of other fields.
|
||||||
# MulitWidgets can themselved be composed of other MultiWidgets.
|
# MulitWidgets can themselves be composed of other MultiWidgets.
|
||||||
# SplitDateTimeWidget is one example of a MultiWidget.
|
# SplitDateTimeWidget is one example of a MultiWidget.
|
||||||
|
|
||||||
class ComplexMultiWidget(MultiWidget):
|
class ComplexMultiWidget(MultiWidget):
|
||||||
|
|
|
@ -1026,7 +1026,7 @@ class FieldsTests(SimpleTestCase):
|
||||||
|
|
||||||
def test_typedchoicefield_4(self):
|
def test_typedchoicefield_4(self):
|
||||||
# Even more weirdness: if you have a valid choice but your coercion function
|
# Even more weirdness: if you have a valid choice but your coercion function
|
||||||
# can't coerce, yo'll still get a validation error. Don't do this!
|
# can't coerce, you'll still get a validation error. Don't do this!
|
||||||
f = TypedChoiceField(choices=[('A', 'A'), ('B', 'B')], coerce=int)
|
f = TypedChoiceField(choices=[('A', 'A'), ('B', 'B')], coerce=int)
|
||||||
self.assertRaisesMessage(ValidationError, "'Select a valid choice. B is not one of the available choices.'", f.clean, 'B')
|
self.assertRaisesMessage(ValidationError, "'Select a valid choice. B is not one of the available choices.'", f.clean, 'B')
|
||||||
# Required fields require values
|
# Required fields require values
|
||||||
|
|
|
@ -893,7 +893,7 @@ class FormsFormsetTestCase(TestCase):
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Formets can override the default iteration order
|
# Formsets can override the default iteration order
|
||||||
class BaseReverseFormSet(BaseFormSet):
|
class BaseReverseFormSet(BaseFormSet):
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return reversed(self.forms)
|
return reversed(self.forms)
|
||||||
|
|
|
@ -510,7 +510,7 @@ class SymlinkExtractorTests(ExtractorTests):
|
||||||
else:
|
else:
|
||||||
# On Python >= 3.2) os.symlink() exists always but then can
|
# On Python >= 3.2) os.symlink() exists always but then can
|
||||||
# fail at runtime when user hasn't the needed permissions on
|
# fail at runtime when user hasn't the needed permissions on
|
||||||
# WIndows versions that support symbolink links (>= 6/Vista).
|
# Windows versions that support symbolink links (>= 6/Vista).
|
||||||
# See Python issue 9333 (http://bugs.python.org/issue9333).
|
# See Python issue 9333 (http://bugs.python.org/issue9333).
|
||||||
# Skip the test in that case
|
# Skip the test in that case
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -90,7 +90,7 @@ class ManyToManySignalsTest(TestCase):
|
||||||
})
|
})
|
||||||
self.assertEqual(self.m2m_changed_messages, expected_messages)
|
self.assertEqual(self.m2m_changed_messages, expected_messages)
|
||||||
|
|
||||||
# give the BMW and Toyata some doors as well
|
# give the BMW and Toyota some doors as well
|
||||||
self.doors.car_set.add(self.bmw, self.toyota)
|
self.doors.car_set.add(self.bmw, self.toyota)
|
||||||
expected_messages.append({
|
expected_messages.append({
|
||||||
'instance': self.doors,
|
'instance': self.doors,
|
||||||
|
|
|
@ -86,7 +86,7 @@ class StateTests(TestCase):
|
||||||
mgr2 = FoodManager('x', 'y', c=3, d=4)
|
mgr2 = FoodManager('x', 'y', c=3, d=4)
|
||||||
|
|
||||||
class FoodOrderedManagers(models.Model):
|
class FoodOrderedManagers(models.Model):
|
||||||
# The managers on this model should be orderd by their creation
|
# The managers on this model should be ordered by their creation
|
||||||
# counter and not by the order in model body
|
# counter and not by the order in model body
|
||||||
|
|
||||||
food_no_mgr = NoMigrationFoodManager('x', 'y')
|
food_no_mgr = NoMigrationFoodManager('x', 'y')
|
||||||
|
|
|
@ -333,7 +333,7 @@ class BooleanFieldTests(unittest.TestCase):
|
||||||
|
|
||||||
# Test select_related('fk_field_name')
|
# Test select_related('fk_field_name')
|
||||||
ma = FksToBooleans.objects.select_related('bf').get(pk=m1.id)
|
ma = FksToBooleans.objects.select_related('bf').get(pk=m1.id)
|
||||||
# verify types -- should't be 0/1
|
# verify types -- shouldn't be 0/1
|
||||||
self.assertIsInstance(ma.bf.bfield, bool)
|
self.assertIsInstance(ma.bf.bfield, bool)
|
||||||
self.assertIsInstance(ma.nbf.nbfield, bool)
|
self.assertIsInstance(ma.nbf.nbfield, bool)
|
||||||
# verify values
|
# verify values
|
||||||
|
|
|
@ -1067,7 +1067,7 @@ class ModelFormsetTest(TestCase):
|
||||||
self.assertEqual(revision1.repository, repository)
|
self.assertEqual(revision1.repository, repository)
|
||||||
self.assertEqual(revision1.revision, '146239817507f148d448db38840db7c3cbf47c76')
|
self.assertEqual(revision1.revision, '146239817507f148d448db38840db7c3cbf47c76')
|
||||||
|
|
||||||
# attempt to save the same revision against against the same repo.
|
# attempt to save the same revision against the same repo.
|
||||||
data = {
|
data = {
|
||||||
'revision_set-TOTAL_FORMS': '1',
|
'revision_set-TOTAL_FORMS': '1',
|
||||||
'revision_set-INITIAL_FORMS': '0',
|
'revision_set-INITIAL_FORMS': '0',
|
||||||
|
|
|
@ -1758,7 +1758,7 @@ class DisjunctiveFilterTests(TestCase):
|
||||||
# Another variation on the disjunctive filtering theme.
|
# Another variation on the disjunctive filtering theme.
|
||||||
|
|
||||||
# For the purposes of this regression test, it's important that there is no
|
# For the purposes of this regression test, it's important that there is no
|
||||||
# Join object releated to the LeafA we create.
|
# Join object related to the LeafA we create.
|
||||||
LeafA.objects.create(data='first')
|
LeafA.objects.create(data='first')
|
||||||
self.assertQuerysetEqual(LeafA.objects.all(), ['<LeafA: first>'])
|
self.assertQuerysetEqual(LeafA.objects.all(), ['<LeafA: first>'])
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
|
|
|
@ -352,7 +352,7 @@ class RequestsTests(SimpleTestCase):
|
||||||
"""
|
"""
|
||||||
Reading body after parsing multipart/form-data is not allowed
|
Reading body after parsing multipart/form-data is not allowed
|
||||||
"""
|
"""
|
||||||
# Because multipart is used for large amounts fo data i.e. file uploads,
|
# Because multipart is used for large amounts of data i.e. file uploads,
|
||||||
# we don't want the data held in memory twice, and we don't want to
|
# we don't want the data held in memory twice, and we don't want to
|
||||||
# silence the error by setting body = '' either.
|
# silence the error by setting body = '' either.
|
||||||
payload = FakePayload("\r\n".join([
|
payload = FakePayload("\r\n".join([
|
||||||
|
|
|
@ -117,7 +117,7 @@ class ClassDecoratedTestCase(ClassDecoratedTestCaseSuper):
|
||||||
self.assertEqual(settings.TEST, 'override')
|
self.assertEqual(settings.TEST, 'override')
|
||||||
|
|
||||||
def test_setupclass_override(self):
|
def test_setupclass_override(self):
|
||||||
"""Test that settings are overriden within setUpClass -- refs #21281"""
|
"""Test that settings are overridden within setUpClass -- refs #21281"""
|
||||||
self.assertEqual(self.foo, 'override')
|
self.assertEqual(self.foo, 'override')
|
||||||
|
|
||||||
@override_settings(TEST='override2')
|
@override_settings(TEST='override2')
|
||||||
|
|
Loading…
Reference in New Issue