mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Refs #33348 -- Made SimpleTestCase.assertFormError() raise ValueError when "field" is passed without "form_index".
This commit is contained in:
parent
d4c9dab74b
commit
f7e0bffa2e
2 changed files with 15 additions and 0 deletions
|
@ -1603,6 +1603,17 @@ class AssertFormsetErrorTests(SimpleTestCase):
|
|||
)
|
||||
self.assertFormsetError(response, "formset", None, None, "error")
|
||||
|
||||
def test_non_form_errors_with_field(self):
|
||||
response = mock.Mock(
|
||||
context=[
|
||||
{},
|
||||
{"formset": TestFormset.invalid(nonform=True)},
|
||||
]
|
||||
)
|
||||
msg = "You must use field=None with form_index=None."
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
self.assertFormsetError(response, "formset", None, "field", "error")
|
||||
|
||||
def test_form_index_too_big(self):
|
||||
msg = (
|
||||
"The formset <TestFormset: bound=True valid=False total_forms=1> only has "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue