Skip to content

Commit

Permalink
Issue python#20804: Document the limitation of the unittest.mock.sent…
Browse files Browse the repository at this point in the history
…inel attributes.
  • Loading branch information
serhiy-storchaka committed Jan 11, 2017
1 parent 924aaae commit 87006a3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Doc/library/unittest.mock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,9 @@ sentinel
the same attribute will always return the same object. The objects
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
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
Expand Down

0 comments on commit 87006a3

Please sign in to comment.