From 5a3b5d623d2f5111271125e06c1d019583311241 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 14 Aug 2022 18:07:20 +0100 Subject: [PATCH] Add different signatures for form assertions from Django 4.1 --- django-stubs/test/testcases.pyi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/django-stubs/test/testcases.pyi b/django-stubs/test/testcases.pyi index efffc09b1..ddd03de03 100644 --- a/django-stubs/test/testcases.pyi +++ b/django-stubs/test/testcases.pyi @@ -25,6 +25,7 @@ from django.db import connections as connections # noqa: F401 from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models.base import Model from django.db.models.query import QuerySet, RawQuerySet +from django.forms import BaseFormSet, Form from django.forms.fields import EmailField from django.http.response import FileResponse, HttpResponseBase from django.template.base import Template @@ -105,6 +106,15 @@ class SimpleTestCase(unittest.TestCase): msg_prefix: str = ..., html: bool = ..., ) -> None: ... + @overload + def assertFormError( + self, + form: Form, + field: Optional[str], + errors: Union[List[str], str], + msg_prefix: str = ..., + ) -> None: ... + @overload def assertFormError( self, response: HttpResponseBase, @@ -113,6 +123,16 @@ class SimpleTestCase(unittest.TestCase): errors: Union[List[str], str], msg_prefix: str = ..., ) -> None: ... + @overload + def assertFormsetError( + self, + formset: BaseFormSet, + form_index: Optional[int], + field: Optional[str], + errors: Union[List[str], str], + msg_prefix: str = ..., + ) -> None: ... + @overload def assertFormsetError( self, response: HttpResponseBase,