From abb08e3af6aa19928007a349592e95e6de38467f Mon Sep 17 00:00:00 2001 From: Jack DeVries <58614260+jdevries3133@users.noreply.github.com> Date: Mon, 5 Jul 2021 02:52:32 -0400 Subject: bpo-44534: fix wording and docstring sync in unittest.Mock GH27000 --- Doc/library/unittest.mock.rst | 2 +- Lib/unittest/mock.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index f1c0757..e760321 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 a4e571a..5be9120 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1215,6 +1215,11 @@ class Mock(CallableMixin, NonCallableMock): 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 -- cgit v0.12