diff options
Diffstat (limited to 'tests/forms_tests')
-rw-r--r-- | tests/forms_tests/tests/test_forms.py | 20 | ||||
-rw-r--r-- | tests/forms_tests/tests/test_formsets.py | 9 | ||||
-rw-r--r-- | tests/forms_tests/tests/test_input_formats.py | 144 | ||||
-rw-r--r-- | tests/forms_tests/tests/test_media.py | 2 | ||||
-rw-r--r-- | tests/forms_tests/tests/test_utils.py | 2 | ||||
-rw-r--r-- | tests/forms_tests/tests/test_widgets.py | 2 | ||||
-rw-r--r-- | tests/forms_tests/tests/tests.py | 6 | ||||
-rw-r--r-- | tests/forms_tests/widget_tests/test_nullbooleanselect.py | 3 |
8 files changed, 93 insertions, 95 deletions
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 5ae4ca042f..8007ad85af 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -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'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): diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py index 792d811f4c..724c16c4fa 100644 --- a/tests/forms_tests/tests/test_formsets.py +++ b/tests/forms_tests/tests/test_formsets.py @@ -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'}, diff --git a/tests/forms_tests/tests/test_input_formats.py b/tests/forms_tests/tests/test_input_formats.py index d0f7fac45a..690a338f4e 100644 --- a/tests/forms_tests/tests/test_input_formats.py +++ b/tests/forms_tests/tests/test_input_formats.py @@ -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") diff --git a/tests/forms_tests/tests/test_media.py b/tests/forms_tests/tests/test_media.py index 945d9d059a..d0d226d06e 100644 --- a/tests/forms_tests/tests/test_media.py +++ b/tests/forms_tests/tests/test_media.py @@ -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" /> diff --git a/tests/forms_tests/tests/test_utils.py b/tests/forms_tests/tests/test_utils.py index 9104d235dd..a6a2d81b9f 100644 --- a/tests/forms_tests/tests/test_utils.py +++ b/tests/forms_tests/tests/test_utils.py @@ -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) diff --git a/tests/forms_tests/tests/test_widgets.py b/tests/forms_tests/tests/test_widgets.py index fadb786c3b..7ea2b35266 100644 --- a/tests/forms_tests/tests/test_widgets.py +++ b/tests/forms_tests/tests/test_widgets.py @@ -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])) diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py index 81a6feef2a..c19d1a66cd 100644 --- a/tests/forms_tests/tests/tests.py +++ b/tests/forms_tests/tests/tests.py @@ -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), diff --git a/tests/forms_tests/widget_tests/test_nullbooleanselect.py b/tests/forms_tests/widget_tests/test_nullbooleanselect.py index b9d55200c5..779a88893f 100644 --- a/tests/forms_tests/widget_tests/test_nullbooleanselect.py +++ b/tests/forms_tests/widget_tests/test_nullbooleanselect.py @@ -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() |