55from __future__ import annotations
66
77from functools import wraps
8- from typing import TYPE_CHECKING , Any , Callable
8+ from typing import TYPE_CHECKING
99
1010from django import VERSION
1111from django .test import LiveServerTestCase , SimpleTestCase , TestCase , TransactionTestCase
@@ -24,6 +24,15 @@ class MessagesTestCase(MessagesTestMixin, TestCase):
2424else :
2525 test_case = TestCase ("run" )
2626
27+ if TYPE_CHECKING :
28+ from collections .abc import Callable , Collection , Iterator , Sequence
29+ from contextlib import AbstractContextManager
30+ from typing import Any , overload
31+
32+ from django import forms
33+ from django .db .models import Model , QuerySet , RawQuerySet
34+ from django .http .response import HttpResponseBase
35+
2736
2837def _wrapper (name : str ) -> Callable [..., Any ]:
2938 func = getattr (test_case , name )
@@ -55,13 +64,6 @@ def assertion_func(*args: Any, **kwargs: Any) -> Any:
5564
5665
5766if TYPE_CHECKING :
58- from collections .abc import Collection , Iterator , Sequence
59- from contextlib import AbstractContextManager
60- from typing import overload
61-
62- from django import forms
63- from django .db .models import Model , QuerySet , RawQuerySet
64- from django .http .response import HttpResponseBase
6567
6668 def assertRedirects (
6769 response : HttpResponseBase ,
0 commit comments