Commit 87006a3d authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #20804: Document the limitation of the unittest.mock.sentinel attributes.

parent 924aaae4
...@@ -1795,6 +1795,9 @@ sentinel ...@@ -1795,6 +1795,9 @@ sentinel
the same attribute will always return the same object. The objects the same attribute will always return the same object. The objects
returned have a sensible repr so that test failure messages are readable. returned have a sensible repr so that test failure messages are readable.
The ``sentinel`` attributes don't preserve their identity when they are
:mod:`copied <copy>` or :mod:`pickled <pickle>`.
Sometimes when testing you need to test that a specific object is passed as an Sometimes when testing you need to test that a specific object is passed as an
argument to another method, or returned. It can be common to create named argument to another method, or returned. It can be common to create named
sentinel objects to test this. :data:`sentinel` provides a convenient way of sentinel objects to test this. :data:`sentinel` provides a convenient way of
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment