[Python-checkins] bpo-44534: fix wording and docstring sync in unittest.Mock GH27000

cjw296 webhook-mailer at python.org
Mon Jul 5 02:52:46 EDT 2021


https://github.com/python/cpython/commit/abb08e3af6aa19928007a349592e95e6de38467f
commit: abb08e3af6aa19928007a349592e95e6de38467f
branch: main
author: Jack DeVries <58614260+jdevries3133 at users.noreply.github.com>
committer: cjw296 <chris at withers.org>
date: 2021-07-05T07:52:32+01:00
summary:

bpo-44534: fix wording and docstring sync in unittest.Mock GH27000

files:
M Doc/library/unittest.mock.rst
M Lib/unittest/mock.py

diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
index f1c0757c510fa..e760321ba129c 100644
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -262,7 +262,7 @@ the *new_callable* argument to :func:`patch`.
       this is a new Mock (created on first access). See the
       :attr:`return_value` attribute.
 
-    * *unsafe*: By default, accessing any attribute with name starting with
+    * *unsafe*: By default, accessing any attribute whose name starts with
       *assert*, *assret*, *asert*, *aseert* or *assrt* will raise an
       :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to
       these attributes.
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index a4e571a80508e..5be91203ec7d7 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -1215,6 +1215,11 @@ class or instance) that acts as the specification for the mock object. If
       this is a new Mock (created on first access). See the
       `return_value` attribute.
 
+    * `unsafe`: By default, accessing any attribute whose name starts with
+      *assert*, *assret*, *asert*, *aseert* or *assrt* will raise an
+       AttributeError. Passing `unsafe=True` will allow access to
+      these attributes.
+
     * `wraps`: Item for the mock object to wrap. If `wraps` is not None then
       calling the Mock will pass the call through to the wrapped object
       (returning the real result). Attribute access on the mock will return a



More information about the Python-checkins mailing list