From 66383ee8e3b7c04642440fb4a63e7fad20f6b5aa Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 21 Apr 2022 14:07:55 -0700 Subject: [PATCH] unittest.mock: target must be a str (#7672) See [the CPython source](https://github.com/python/cpython/blob/eaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65/Lib/unittest/mock.py#L1754). It calls `_get_target`, and [that](https://github.com/python/cpython/blob/eaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65/Lib/unittest/mock.py#L1594) does `target.rsplit('.', 1)`. --- stdlib/unittest/mock.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index aca331a4c..400bdaac3 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -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 = ...,