@@ -303,7 +303,7 @@ class _patcher:
303303 create : bool = ...,
304304 spec_set : Any | None = ...,
305305 autospec : Any | None = ...,
306- new_callable : Any | None = ...,
306+ new_callable : Callable [..., Any ] | None = ...,
307307 ** kwargs : Any ,
308308 ) -> _patch [_T ]: ...
309309 @overload
@@ -315,7 +315,19 @@ class _patcher:
315315 create : bool = ...,
316316 spec_set : Any | None = ...,
317317 autospec : Any | None = ...,
318- new_callable : Any | None = ...,
318+ new_callable : Callable [..., _T ],
319+ ** kwargs : Any ,
320+ ) -> _patch [_T ]: ...
321+ @overload
322+ def __call__ (
323+ self ,
324+ target : str ,
325+ * ,
326+ spec : Any | None = ...,
327+ create : bool = ...,
328+ spec_set : Any | None = ...,
329+ autospec : Any | None = ...,
330+ new_callable : None = ...,
319331 ** kwargs : Any ,
320332 ) -> _patch_default_new : ...
321333 @overload
@@ -328,7 +340,7 @@ class _patcher:
328340 create : bool = ...,
329341 spec_set : Any | None = ...,
330342 autospec : Any | None = ...,
331- new_callable : Any | None = ...,
343+ new_callable : Callable [..., Any ] | None = ...,
332344 ** kwargs : Any ,
333345 ) -> _patch [_T ]: ...
334346 @overload
@@ -341,7 +353,20 @@ class _patcher:
341353 create : bool = ...,
342354 spec_set : Any | None = ...,
343355 autospec : Any | None = ...,
344- new_callable : Any | None = ...,
356+ new_callable : Callable [..., _T ],
357+ ** kwargs : Any ,
358+ ) -> _patch [_T ]: ...
359+ @overload
360+ @staticmethod
361+ def object (
362+ target : Any ,
363+ attribute : str ,
364+ * ,
365+ spec : Any | None = ...,
366+ create : bool = ...,
367+ spec_set : Any | None = ...,
368+ autospec : Any | None = ...,
369+ new_callable : None = ...,
345370 ** kwargs : Any ,
346371 ) -> _patch [MagicMock | AsyncMock ]: ...
347372 @staticmethod
0 commit comments