unittest.mock: target must be a str (#7672)

See [the CPython source](eaa85cb22f/Lib/unittest/mock.py (L1754)). It calls `_get_target`, and [that](eaa85cb22f/Lib/unittest/mock.py (L1594)) does `target.rsplit('.', 1)`.
This commit is contained in:
Jelle Zijlstra
2022-04-21 14:07:55 -07:00
committed by GitHub
parent 32871c0d64
commit 66383ee8e3

View File

@@ -297,7 +297,7 @@ class _patcher:
@overload
def __call__( # type: ignore[misc]
self,
target: Any,
target: str,
new: _T,
spec: Any | None = ...,
create: bool = ...,
@@ -309,7 +309,7 @@ class _patcher:
@overload
def __call__(
self,
target: Any,
target: str,
*,
spec: Any | None = ...,
create: bool = ...,