Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.

This commit is contained in:
za 2016-10-27 14:53:39 +07:00 committed by Tim Graham
parent 4bb70cbcc6
commit 321e94fa41
185 changed files with 1216 additions and 1528 deletions

View file

@ -8,7 +8,7 @@ import uuid
from django.core.exceptions import NON_FIELD_ERRORS
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import RegexValidator
from django.core.validators import MaxValueValidator, RegexValidator
from django.forms import (
BooleanField, CharField, CheckboxSelectMultiple, ChoiceField, DateField,
DateTimeField, EmailField, FileField, FloatField, Form, HiddenInput,
@ -1134,7 +1134,7 @@ value="Should escape < & > and <script>alert('xss')</
except ValidationError as e:
self._errors = e.update_error_dict(self._errors)
# Ensure that the newly added list of errors is an instance of ErrorList.
# The newly added list of errors is an instance of ErrorList.
for field, error_list in self._errors.items():
if not isinstance(error_list, self.error_class):
self._errors[field] = self.error_class(error_list)
@ -1143,7 +1143,7 @@ value="Should escape < & > and <script>alert('xss')</
# Trigger validation.
self.assertFalse(form.is_valid())
# Check that update_error_dict didn't lose track of the ErrorDict type.
# update_error_dict didn't lose track of the ErrorDict type.
self.assertIsInstance(form._errors, forms.ErrorDict)
self.assertEqual(dict(form.errors), {
@ -1325,10 +1325,10 @@ value="Should escape < & > and <script>alert('xss')</
self.assertEqual(f['gender'].field.choices, [('f', 'Female'), ('m', 'Male')])
def test_validators_independence(self):
""" Test that we are able to modify a form field validators list without polluting
other forms """
from django.core.validators import MaxValueValidator
"""
The list of form field validators can be modified without polluting
other forms.
"""
class MyForm(Form):
myfield = CharField(max_length=25)
@ -1931,7 +1931,7 @@ Password: <input type="password" name="password" required /></li>
self.assertIn('last_name', p.changed_data)
self.assertNotIn('birthday', p.changed_data)
# Test that field raising ValidationError is always in changed_data
# A field raising ValidationError is always in changed_data
class PedanticField(forms.Field):
def to_python(self, value):
raise ValidationError('Whatever')
@ -1990,7 +1990,7 @@ Password: <input type="password" name="password" required /></li>
def test_boundfield_rendering(self):
"""
Python 2 issue: Test that rendering a BoundField with bytestring content
Python 2 issue: Rendering a BoundField with bytestring content
doesn't lose it's safe string status (#22950).
"""
class CustomWidget(TextInput):
@ -2937,7 +2937,7 @@ Good luck picking a username that doesn&#39;t already exist.</p>
def test_custom_empty_values(self):
"""
Test that form fields can customize what is considered as an empty value
Form fields can customize what is considered as an empty value
for themselves (#19997).
"""
class CustomJSONField(CharField):

View file

@ -128,7 +128,7 @@ class FormsFormsetTestCase(SimpleTestCase):
def test_form_kwargs_formset(self):
"""
Test that custom kwargs set on the formset instance are passed to the
Custom kwargs set on the formset instance are passed to the
underlying forms.
"""
FormSet = formset_factory(CustomKwargForm, extra=2)
@ -139,7 +139,7 @@ class FormsFormsetTestCase(SimpleTestCase):
def test_form_kwargs_formset_dynamic(self):
"""
Test that form kwargs can be passed dynamically in a formset.
Form kwargs can be passed dynamically in a formset.
"""
class DynamicBaseFormSet(BaseFormSet):
def get_form_kwargs(self, index):
@ -856,8 +856,7 @@ class FormsFormsetTestCase(SimpleTestCase):
<td><input type="text" name="form-1-name" id="id_form-1-name" /></td></tr>"""
)
# Ensure that max_num has no effect when extra is less than max_num.
# max_num has no effect when extra is less than max_num.
LimitedFavoriteDrinkFormSet = formset_factory(FavoriteDrinkForm, extra=1, max_num=2)
formset = LimitedFavoriteDrinkFormSet()
form_output = []
@ -1342,7 +1341,7 @@ class TestIsBoundBehavior(SimpleTestCase):
class TestEmptyFormSet(SimpleTestCase):
def test_empty_formset_is_valid(self):
"""Test that an empty formset still calls clean()"""
"""An empty formset still calls clean()"""
EmptyFsetWontValidateFormset = formset_factory(FavoriteDrinkForm, extra=0, formset=EmptyFsetWontValidate)
formset = EmptyFsetWontValidateFormset(
data={'form-INITIAL_FORMS': '0', 'form-TOTAL_FORMS': '0'},

View file

@ -26,7 +26,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13:30:05')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip
# The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '13:30:05')
@ -34,7 +34,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13:30')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@ -53,7 +53,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13:30:05')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '13:30:05')
@ -61,7 +61,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13:30')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@ -78,7 +78,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13.30.05')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@ -86,7 +86,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13.30')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@ -103,7 +103,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13.30.05')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@ -111,7 +111,7 @@ class LocalizedTimeTests(SimpleTestCase):
result = f.clean('13.30')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@ -129,7 +129,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30:05 PM')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip
# The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '01:30:05 PM')
@ -137,7 +137,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30 PM')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM")
@ -152,7 +152,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30:05 PM')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '01:30:05 PM')
@ -160,7 +160,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('01:30 PM')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM")
@ -177,7 +177,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('13.30.05')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:05 PM")
@ -185,7 +185,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('13.30')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM")
@ -202,7 +202,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('13.30.05')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:05 PM")
@ -210,7 +210,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('13.30')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM")
@ -227,7 +227,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('13:30:05')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@ -235,7 +235,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('13:30')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@ -250,7 +250,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('13:30:05')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@ -258,7 +258,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('13:30')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@ -273,7 +273,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('1:30:05 PM')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@ -281,7 +281,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('1:30 PM')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@ -296,7 +296,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('1:30:05 PM')
self.assertEqual(result, time(13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:05")
@ -304,7 +304,7 @@ class SimpleTimeFormatTests(SimpleTestCase):
result = f.clean('1:30 PM')
self.assertEqual(result, time(13, 30, 0))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "13:30:00")
@ -331,7 +331,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip
# The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010')
@ -339,7 +339,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('21.12.10')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -354,7 +354,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010')
@ -362,7 +362,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('21.12.10')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -381,7 +381,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -389,7 +389,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('12-21-2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -408,7 +408,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -416,7 +416,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('12-21-2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -434,7 +434,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip
# The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010')
@ -442,7 +442,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('21-12-2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -457,7 +457,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010')
@ -465,7 +465,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('21-12-2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -482,7 +482,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -490,7 +490,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('12-21-2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -507,7 +507,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -515,7 +515,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('12-21-2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010")
@ -532,7 +532,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('2010-12-21')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@ -540,7 +540,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('12/21/2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@ -555,7 +555,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('2010-12-21')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@ -563,7 +563,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('12/21/2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@ -578,7 +578,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@ -586,7 +586,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('21-12-2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@ -601,7 +601,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('21.12.2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@ -609,7 +609,7 @@ class SimpleDateFormatTests(SimpleTestCase):
result = f.clean('21-12-2010')
self.assertEqual(result, date(2010, 12, 21))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21")
@ -636,7 +636,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('21.12.2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip
# The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010 13:30:05')
@ -644,7 +644,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('21.12.2010 13:30')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:00")
@ -659,7 +659,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('21.12.2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '21.12.2010 13:30:05')
@ -667,7 +667,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('21.12.2010 13:30')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:00")
@ -686,7 +686,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('13.30.05 12.21.2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:05")
@ -694,7 +694,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('13.30 12-21-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:00")
@ -713,7 +713,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('13.30.05 12.21.2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:05")
@ -721,7 +721,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('13.30 12-21-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "21.12.2010 13:30:00")
@ -739,7 +739,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30:05 PM 21/12/2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip
# The parsed result does a round trip
text = f.widget.format_value(result)
self.assertEqual(text, '01:30:05 PM 21/12/2010')
@ -747,7 +747,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30 PM 21-12-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM 21/12/2010")
@ -762,7 +762,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30:05 PM 21/12/2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, '01:30:05 PM 21/12/2010')
@ -770,7 +770,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('1:30 PM 21-12-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM 21/12/2010")
@ -787,7 +787,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:05 PM 21/12/2010")
@ -795,7 +795,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('12-21-2010 13:30')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM 21/12/2010")
@ -812,7 +812,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:05 PM 21/12/2010")
@ -820,7 +820,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('12-21-2010 13:30')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "01:30:00 PM 21/12/2010")
@ -837,7 +837,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('2010-12-21 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@ -845,7 +845,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('12/21/2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@ -860,7 +860,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('2010-12-21 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@ -868,7 +868,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('12/21/2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@ -883,7 +883,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('1:30:05 PM 21.12.2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@ -891,7 +891,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('1:30 PM 21-12-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:00")
@ -906,7 +906,7 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('1:30:05 PM 21.12.2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# Check that the parsed result does a round trip to the same format
# The parsed result does a round trip to the same format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:05")
@ -914,6 +914,6 @@ class SimpleDateTimeFormatTests(SimpleTestCase):
result = f.clean('1:30 PM 21-12-2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30))
# Check that the parsed result does a round trip to default format
# The parsed result does a round trip to default format
text = f.widget.format_value(result)
self.assertEqual(text, "2010-12-21 13:30:00")

View file

@ -126,7 +126,7 @@ class FormsMediaTestCase(SimpleTestCase):
<script type="text/javascript" src="/path/to/js4"></script>"""
)
# Check that media addition hasn't affected the original objects
# media addition hasn't affected the original objects
self.assertEqual(
str(w1.media),
"""<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet" />

View file

@ -38,7 +38,7 @@ class FormsUtilsTestCase(SimpleTestCase):
def test_flatatt_no_side_effects(self):
"""
Fixes #23883 -- Check that flatatt does not modify the dict passed in
flatatt() does not modify the dict passed in.
"""
attrs = {'foo': 'bar', 'true': True, 'false': False}
attrs_copy = copy.copy(attrs)

View file

@ -184,7 +184,7 @@ class LiveWidgetTests(AdminSeleniumTestCase):
def test_textarea_trailing_newlines(self):
"""
Test that a roundtrip on a ModelForm doesn't alter the TextField value
A roundtrip on a ModelForm doesn't alter the TextField value
"""
article = Article.objects.create(content="\nTst\n")
self.selenium.get(self.live_server_url + reverse('article_form', args=[article.pk]))

View file

@ -80,14 +80,14 @@ class TestModelChoiceField(TestCase):
class TestTicket14567(TestCase):
"""
Check that the return values of ModelMultipleChoiceFields are QuerySets
The return values of ModelMultipleChoiceFields are QuerySets
"""
def test_empty_queryset_return(self):
"If a model's ManyToManyField has blank=True and is saved with no data, a queryset is returned."
option = ChoiceOptionModel.objects.create(name='default')
form = OptionalMultiChoiceModelForm({'multi_choice_optional': '', 'multi_choice': [option.pk]})
self.assertTrue(form.is_valid())
# Check that the empty value is a QuerySet
# The empty value is a QuerySet
self.assertIsInstance(form.cleaned_data['multi_choice_optional'], models.query.QuerySet)
# While we're at it, test whether a QuerySet is returned if there *is* a value.
self.assertIsInstance(form.cleaned_data['multi_choice'], models.query.QuerySet)
@ -330,7 +330,7 @@ class EmptyLabelTestCase(TestCase):
)
def test_save_empty_label_forms(self):
# Test that saving a form with a blank choice results in the expected
# Saving a form with a blank choice results in the expected
# value being stored in the database.
tests = [
(EmptyCharLabelNoneChoiceForm, 'choice_string_w_none', None),

View file

@ -47,8 +47,7 @@ class NullBooleanSelectTest(WidgetTest):
@override_settings(USE_L10N=True)
def test_l10n(self):
"""
Ensure that the NullBooleanSelect widget's options are lazily
localized (#17190).
The NullBooleanSelect widget's options are lazily localized (#17190).
"""
widget = NullBooleanSelect()