From 87006a3d4a6c7616ab885ae697ae60a2f62e2d7a Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 11 Jan 2017 20:16:44 +0200 Subject: [PATCH] Issue #20804: Document the limitation of the unittest.mock.sentinel attributes. --- Doc/library/unittest.mock.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index ef30c01b99..4b9dac402f 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -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 ` or :mod:`pickled `. + 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 -- 2.40.0