Refs #33990 -- Removed SimpleTestCase.assertFormsetError() per deprecation timeline.

This commit is contained in:
Mariusz Felisiak 2023-09-14 12:39:20 +02:00
parent 7433237664
commit c35fd9e275
4 changed files with 2 additions and 23 deletions

View File

@ -601,15 +601,6 @@ class SimpleTestCase(unittest.TestCase):
errors = to_list(errors)
self._assert_form_error(form, field, errors, msg_prefix, f"form {form!r}")
# RemovedInDjango51Warning.
def assertFormsetError(self, *args, **kw):
warnings.warn(
"assertFormsetError() is deprecated in favor of assertFormSetError().",
category=RemovedInDjango51Warning,
stacklevel=2,
)
return self.assertFormSetError(*args, **kw)
def assertFormSetError(self, formset, form_index, field, errors, msg_prefix=""):
"""
Similar to assertFormError() but for formsets.

View File

@ -270,3 +270,5 @@ to remove usage of these features.
* The ``map_width`` and ``map_height`` attributes of ``BaseGeometryWidget`` are
removed.
* The ``SimpleTestCase.assertFormsetError()`` method is removed.

View File

@ -1681,11 +1681,6 @@ your test suite.
``field`` and ``errors`` have the same meaning as the parameters to
``assertFormError()``.
.. deprecated:: 4.2
The ``assertFormsetError()`` assertion method is deprecated. Use
``assertFormSetError()`` instead.
.. method:: SimpleTestCase.assertContains(response, text, count=None, status_code=200, msg_prefix='', html=False)
Asserts that a :class:`response <django.http.HttpResponse>` produced the

View File

@ -1425,15 +1425,6 @@ class AssertFormErrorTests(SimpleTestCase):
class AssertFormSetErrorTests(SimpleTestCase):
def test_rename_assertformseterror_deprecation_warning(self):
msg = "assertFormsetError() is deprecated in favor of assertFormSetError()."
with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
self.assertFormsetError()
@ignore_warnings(category=RemovedInDjango51Warning)
def test_deprecated_assertformseterror(self):
self.assertFormsetError(TestFormset.invalid(), 0, "field", "invalid value")
def test_single_error(self):
self.assertFormSetError(TestFormset.invalid(), 0, "field", "invalid value")