summaryrefslogtreecommitdiff
path: root/tests/forms_tests/field_tests
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2025-07-22 20:41:41 -0700
committernessita <124304+nessita@users.noreply.github.com>2025-07-23 20:17:55 -0300
commit69a93a88edb56ba47f624dac7a21aacc47ea474f (patch)
treef57507a4435d032493cae40e06ecb254790b67b2 /tests/forms_tests/field_tests
parent55b0cc21310b76ce4018dd793ba50556eaf0af06 (diff)
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
Diffstat (limited to 'tests/forms_tests/field_tests')
-rw-r--r--tests/forms_tests/field_tests/test_booleanfield.py3
-rw-r--r--tests/forms_tests/field_tests/test_charfield.py3
-rw-r--r--tests/forms_tests/field_tests/test_datefield.py4
-rw-r--r--tests/forms_tests/field_tests/test_filefield.py4
-rw-r--r--tests/forms_tests/field_tests/test_typedchoicefield.py11
-rw-r--r--tests/forms_tests/field_tests/test_typedmultiplechoicefield.py11
6 files changed, 22 insertions, 14 deletions
diff --git a/tests/forms_tests/field_tests/test_booleanfield.py b/tests/forms_tests/field_tests/test_booleanfield.py
index d6b5121b10..f1c06c3c01 100644
--- a/tests/forms_tests/field_tests/test_booleanfield.py
+++ b/tests/forms_tests/field_tests/test_booleanfield.py
@@ -50,7 +50,8 @@ class BooleanFieldTest(SimpleTestCase):
self.assertTrue(f.has_changed(False, "on"))
self.assertFalse(f.has_changed(True, "on"))
self.assertTrue(f.has_changed(True, ""))
- # Initial value may have mutated to a string due to show_hidden_initial (#19537)
+ # Initial value may have mutated to a string due to show_hidden_initial
+ # (#19537)
self.assertTrue(f.has_changed("False", "on"))
# HiddenInput widget sends string values for boolean but doesn't clean
# them in value_from_datadict.
diff --git a/tests/forms_tests/field_tests/test_charfield.py b/tests/forms_tests/field_tests/test_charfield.py
index 2c3f9b7ebe..e1d89523f8 100644
--- a/tests/forms_tests/field_tests/test_charfield.py
+++ b/tests/forms_tests/field_tests/test_charfield.py
@@ -80,7 +80,8 @@ class CharFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
minlength/maxlength if min_length/max_length are defined on the field
and the widget is not hidden.
"""
- # Return an empty dictionary if max_length and min_length are both None.
+ # Return an empty dictionary if max_length and min_length are both
+ # None.
f = CharField()
self.assertEqual(f.widget_attrs(TextInput()), {})
self.assertEqual(f.widget_attrs(Textarea()), {})
diff --git a/tests/forms_tests/field_tests/test_datefield.py b/tests/forms_tests/field_tests/test_datefield.py
index 65ac76319d..a8f39aa8e8 100644
--- a/tests/forms_tests/field_tests/test_datefield.py
+++ b/tests/forms_tests/field_tests/test_datefield.py
@@ -215,6 +215,6 @@ class DateFieldTest(SimpleTestCase):
try:
f.strptime("31 мая 2011", "%d-%b-%y")
except Exception as e:
- # assertIsInstance or assertRaises cannot be used because UnicodeEncodeError
- # is a subclass of ValueError
+ # assertIsInstance or assertRaises cannot be used because
+ # UnicodeEncodeError is a subclass of ValueError
self.assertEqual(e.__class__, ValueError)
diff --git a/tests/forms_tests/field_tests/test_filefield.py b/tests/forms_tests/field_tests/test_filefield.py
index 9744981471..d407df99c9 100644
--- a/tests/forms_tests/field_tests/test_filefield.py
+++ b/tests/forms_tests/field_tests/test_filefield.py
@@ -105,8 +105,8 @@ class FileFieldTest(SimpleTestCase):
# A file was not uploaded, but there is initial data
self.assertFalse(f.has_changed("resume.txt", None))
- # A file was uploaded and there is initial data (file identity is not dealt
- # with here)
+ # A file was uploaded and there is initial data (file identity is not
+ # dealt with here)
self.assertTrue(
f.has_changed(
"resume.txt", {"filename": "resume.txt", "content": "My resume"}
diff --git a/tests/forms_tests/field_tests/test_typedchoicefield.py b/tests/forms_tests/field_tests/test_typedchoicefield.py
index 52a83eca37..3537623272 100644
--- a/tests/forms_tests/field_tests/test_typedchoicefield.py
+++ b/tests/forms_tests/field_tests/test_typedchoicefield.py
@@ -19,13 +19,15 @@ class TypedChoiceFieldTest(SimpleTestCase):
self.assertEqual(1.0, f.clean("1"))
def test_typedchoicefield_3(self):
- # This can also cause weirdness: be careful (bool(-1) == True, remember)
+ # This can also cause weirdness: be careful (bool(-1) == True,
+ # remember)
f = TypedChoiceField(choices=[(1, "+1"), (-1, "-1")], coerce=bool)
self.assertTrue(f.clean("-1"))
def test_typedchoicefield_4(self):
- # Even more weirdness: if you have a valid choice but your coercion function
- # can't coerce, you'll still get a validation error. Don't do this!
+ # Even more weirdness: if you have a valid choice but your coercion
+ # function can't coerce, you'll still get a validation error. Don't do
+ # this!
f = TypedChoiceField(choices=[("A", "A"), ("B", "B")], coerce=int)
msg = "'Select a valid choice. B is not one of the available choices.'"
with self.assertRaisesMessage(ValidationError, msg):
@@ -40,7 +42,8 @@ class TypedChoiceFieldTest(SimpleTestCase):
choices=[(1, "+1"), (-1, "-1")], coerce=int, required=False
)
self.assertEqual("", f.clean(""))
- # If you want cleaning an empty value to return a different type, tell the field
+ # If you want cleaning an empty value to return a different type, tell
+ # the field
def test_typedchoicefield_6(self):
f = TypedChoiceField(
diff --git a/tests/forms_tests/field_tests/test_typedmultiplechoicefield.py b/tests/forms_tests/field_tests/test_typedmultiplechoicefield.py
index 6810f1ed19..e874e192d8 100644
--- a/tests/forms_tests/field_tests/test_typedmultiplechoicefield.py
+++ b/tests/forms_tests/field_tests/test_typedmultiplechoicefield.py
@@ -19,7 +19,8 @@ class TypedMultipleChoiceFieldTest(SimpleTestCase):
self.assertEqual([1.0], f.clean(["1"]))
def test_typedmultiplechoicefield_3(self):
- # This can also cause weirdness: be careful (bool(-1) == True, remember)
+ # This can also cause weirdness: be careful (bool(-1) == True,
+ # remember)
f = TypedMultipleChoiceField(choices=[(1, "+1"), (-1, "-1")], coerce=bool)
self.assertEqual([True], f.clean(["-1"]))
@@ -31,8 +32,9 @@ class TypedMultipleChoiceFieldTest(SimpleTestCase):
f.clean(["1", "2"])
def test_typedmultiplechoicefield_5(self):
- # Even more weirdness: if you have a valid choice but your coercion function
- # can't coerce, you'll still get a validation error. Don't do this!
+ # Even more weirdness: if you have a valid choice but your coercion
+ # function can't coerce, you'll still get a validation error. Don't do
+ # this!
f = TypedMultipleChoiceField(choices=[("A", "A"), ("B", "B")], coerce=int)
msg = "'Select a valid choice. B is not one of the available choices.'"
with self.assertRaisesMessage(ValidationError, msg):
@@ -49,7 +51,8 @@ class TypedMultipleChoiceFieldTest(SimpleTestCase):
self.assertEqual([], f.clean([]))
def test_typedmultiplechoicefield_7(self):
- # If you want cleaning an empty value to return a different type, tell the field
+ # If you want cleaning an empty value to return a different type, tell
+ # the field
f = TypedMultipleChoiceField(
choices=[(1, "+1"), (-1, "-1")],
coerce=int,