diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index 19e9715102bf3a..c19dab5a8d8927 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -1369,7 +1369,8 @@ patch "as"; very useful if :func:`patch` is creating a mock object for you. :func:`patch` takes arbitrary keyword arguments. These will be passed to - the :class:`Mock` (or *new_callable*) on construction. + :class:`AsyncMock` if the patched object is asynchronous, to + :class:`MagicMock` otherwise or to *new_callable* if specified. ``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are available for alternate use-cases. diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 298b41e0d7e4dd..3f071e96b1f957 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1651,7 +1651,8 @@ def patch( "as"; very useful if `patch` is creating a mock object for you. `patch` takes arbitrary keyword arguments. These will be passed to - the `Mock` (or `new_callable`) on construction. + `AsyncMock` if the patched object is asynchronous, to `MagicMock` + otherwise or to `new_callable` if specified. `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are available for alternate use-cases.