summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorNilesh Kumar Pahari <nileshpahari@protonmail.com>2025-12-19 02:15:56 +0530
committerJacob Walls <jacobtylerwalls@gmail.com>2025-12-19 15:10:12 -0500
commite49e14fd9032feb7a8cf254658ac4e74a4ffb712 (patch)
tree8b2858657c52fe90c6a6adcc08fdb84d7f91aa4d /tests/forms_tests
parent5a851bdbfcd627865df7289197190c52221ca070 (diff)
Fixed #36618 -- Corrected error message in BaseForm.add_error().
The error message now correctly states that the error argument is a dictionary.
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/tests/test_forms.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index 8cc1fecf0a..7f698ad706 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -1660,6 +1660,13 @@ aria-describedby="id_birthday_error">
with self.assertRaisesMessage(ValueError, "has no field named"):
f.add_error("missing_field", "Some error.")
+ with self.assertRaisesMessage(
+ TypeError,
+ "The argument `field` must be `None` when the `error` argument is a "
+ "dictionary.",
+ ):
+ f.add_error("password1", ValidationError({"password1": "Some error."}))
+
def test_update_error_dict(self):
class CodeForm(Form):
code = CharField(max_length=10)