mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #20804: The unittest.mock.sentinel attributes now preserve their
identity when they are copied or pickled.
This commit is contained in:
parent
d4f5001bac
commit
d9c956fb23
5 changed files with 33 additions and 0 deletions
|
@ -1831,6 +1831,10 @@ sentinel
|
|||
the same attribute will always return the same object. The objects
|
||||
returned have a sensible repr so that test failure messages are readable.
|
||||
|
||||
.. versionchanged:: 3.7
|
||||
The ``sentinel`` attributes now 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue