Skip to content

Commit 40c0809

Browse files
phsilvacjw296
authored andcommitted
bpo-37955: correct mock.patch docs with respect to the returned type (GH-15521)
1 parent 62865f4 commit 40c0809

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Doc/library/unittest.mock.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,8 @@ patch
14011401
"as"; very useful if :func:`patch` is creating a mock object for you.
14021402

14031403
:func:`patch` takes arbitrary keyword arguments. These will be passed to
1404-
the :class:`Mock` (or *new_callable*) on construction.
1404+
:class:`AsyncMock` if the patched object is asynchronous, to
1405+
:class:`MagicMock` otherwise or to *new_callable* if specified.
14051406

14061407
``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are
14071408
available for alternate use-cases.

Lib/unittest/mock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,8 @@ def patch(
17301730
"as"; very useful if `patch` is creating a mock object for you.
17311731
17321732
`patch` takes arbitrary keyword arguments. These will be passed to
1733-
the `Mock` (or `new_callable`) on construction.
1733+
`AsyncMock` if the patched object is asynchronous, to `MagicMock`
1734+
otherwise or to `new_callable` if specified.
17341735
17351736
`patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are
17361737
available for alternate use-cases.

0 commit comments

Comments
 (0)