From b66d69a9cd5493bfd1454224a36bb1cccdf5d847 Mon Sep 17 00:00:00 2001 From: Pavel Taufer Date: Sun, 1 Sep 2024 01:15:32 +0200 Subject: [PATCH] Fix type hints for assertFormError and assertForSetError. Refs pytest-dev#1137 --- AUTHORS | 1 + pytest_django/asserts.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index 060864a4..1e01a483 100644 --- a/AUTHORS +++ b/AUTHORS @@ -20,3 +20,4 @@ Nicolas Delaby Hasan Ramezani Michael Howitz Mark Gensler +Pavel Taufer diff --git a/pytest_django/asserts.py b/pytest_django/asserts.py index 09f9d8d6..1a1289d9 100644 --- a/pytest_django/asserts.py +++ b/pytest_django/asserts.py @@ -55,6 +55,7 @@ def assertion_func(*args, **kwargs): if TYPE_CHECKING: from django.http.response import HttpResponseBase + import django.forms as forms def assertRedirects( response: HttpResponseBase, @@ -93,8 +94,7 @@ def assertNotContains( ... def assertFormError( - response: HttpResponseBase, - form: str, + form: forms.BaseForm, field: str | None, errors: str | Sequence[str], msg_prefix: str = ..., @@ -102,8 +102,7 @@ def assertFormError( ... def assertFormsetError( - response: HttpResponseBase, - formset: str, + formset: forms.BaseFormSet, form_index: int | None, field: str | None, errors: str | Sequence[str],