Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 87006a3

Browse files
Issue python#20804: Document the limitation of the unittest.mock.sentinel attributes.
1 parent 924aaae commit 87006a3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Doc/library/unittest.mock.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,9 @@ sentinel
17951795
the same attribute will always return the same object. The objects
17961796
returned have a sensible repr so that test failure messages are readable.
17971797

1798+
The ``sentinel`` attributes don't preserve their identity when they are
1799+
:mod:`copied <copy>` or :mod:`pickled <pickle>`.
1800+
17981801
Sometimes when testing you need to test that a specific object is passed as an
17991802
argument to another method, or returned. It can be common to create named
18001803
sentinel objects to test this. :data:`sentinel` provides a convenient way of

0 commit comments

Comments
 (0)