From: Serhiy Storchaka Date: Wed, 11 Jan 2017 18:16:44 +0000 (+0200) Subject: Issue #20804: Document the limitation of the unittest.mock.sentinel attributes. X-Git-Tag: v3.6.1rc1~181^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=87006a3d4a6c7616ab885ae697ae60a2f62e2d7a;p=thirdparty%2FPython%2Fcpython.git Issue #20804: Document the limitation of the unittest.mock.sentinel attributes. --- diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index ef30c01b99f7..4b9dac402f96 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