Skip to content

Commit

Permalink
Add different signatures for form assertions from Django 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Aug 26, 2022
1 parent 041b66a commit c5c6d31
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions django-stubs/test/testcases.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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 Form, Formset
from django.forms.fields import EmailField
from django.http.response import FileResponse, HttpResponseBase
from django.template.base import Template
Expand Down Expand Up @@ -99,6 +100,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,
Expand All @@ -107,6 +117,16 @@ class SimpleTestCase(unittest.TestCase):
errors: Union[List[str], str],
msg_prefix: str = ...,
) -> None: ...
@overload
def assertFormsetError(
self,
formset: Formset,
form_index: Optional[int],
field: Optional[str],
errors: Union[List[str], str],
msg_prefix: str = ...,
) -> None: ...
@overload
def assertFormsetError(
self,
response: HttpResponseBase,
Expand Down

0 comments on commit c5c6d31

Please sign in to comment.