]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-37955: correct mock.patch docs with respect to the returned type (GH-15521)
authorPaulo Henrique Silva <ph.silva@gmail.com>
Sat, 25 Jan 2020 10:53:54 +0000 (07:53 -0300)
committerChris Withers <chris@withers.org>
Sat, 25 Jan 2020 10:53:54 +0000 (10:53 +0000)
Doc/library/unittest.mock.rst
Lib/unittest/mock.py

index 8394304cfdd9a02b2fb6b4f0efd6b654ddac55f4..515bdd060a198cd5e04d67940bc153c79bd51b6b 100644 (file)
@@ -1401,7 +1401,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.
index 047ae7c25599badb62ceae6bb75ed28d81d49b0c..a97542a2ddf00d5b7403b52b0689e29be6a17731 100644 (file)
@@ -1730,7 +1730,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.