Skip to content

Commit 6aecafc

Browse files
flaeppeadamchainz
andauthored
Improve type of TestCase.captureOnCommitCallbacks (#1202)
Co-authored-by: Adam Johnson <[email protected]>
1 parent adb2624 commit 6aecafc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

django-stubs/test/testcases.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import threading
22
import unittest
3+
from contextlib import contextmanager
34
from datetime import date
45
from types import TracebackType
56
from typing import (
67
Any,
78
Callable,
89
Collection,
910
Dict,
11+
Generator,
1012
Iterable,
1113
Iterator,
1214
List,
@@ -216,7 +218,11 @@ class TransactionTestCase(SimpleTestCase):
216218
class TestCase(TransactionTestCase):
217219
@classmethod
218220
def setUpTestData(cls) -> None: ...
219-
def captureOnCommitCallbacks(cls, *, using: Optional[str] = ..., execute: bool = ...): ...
221+
@classmethod
222+
@contextmanager
223+
def captureOnCommitCallbacks(
224+
cls, *, using: str = ..., execute: bool = ...
225+
) -> Generator[List[Callable[[], Any]], None, None]: ...
220226

221227
class CheckCondition:
222228
conditions: Sequence[Tuple[Callable, str]] = ...

0 commit comments

Comments
 (0)