diff options
-rw-r--r-- | Doc/library/unittest.mock.rst | 2 | ||||
-rw-r--r-- | Lib/unittest/mock.py | 5 |
2 files changed, 6 insertions, 1 deletions
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 |