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

This commit is contained in:
Jack DeVries 2021-07-05 02:52:32 -04:00 committed by GitHub
parent a9a69bb3ea
commit abb08e3af6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -262,7 +262,7 @@ the *new_callable* argument to :func:`patch`.
this is a new Mock (created on first access). See the this is a new Mock (created on first access). See the
:attr:`return_value` attribute. :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 *assert*, *assret*, *asert*, *aseert* or *assrt* will raise an
:exc:`AttributeError`. Passing ``unsafe=True`` will allow access to :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to
these attributes. these attributes.

View file

@ -1215,6 +1215,11 @@ class Mock(CallableMixin, NonCallableMock):
this is a new Mock (created on first access). See the this is a new Mock (created on first access). See the
`return_value` attribute. `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 * `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 calling the Mock will pass the call through to the wrapped object
(returning the real result). Attribute access on the mock will return a (returning the real result). Attribute access on the mock will return a