diff options
| author | Chris Withers <chris@withers.org> | 2018-12-03 21:31:37 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-03 21:31:37 (GMT) |
| commit | 8ca0fa9d2f4de6e69f0902790432e0ab2f37ba68 (patch) | |
| tree | c1af80e0a0ee140f84cf87b02caca5e5d9ed67d5 /Doc/library/unittest.mock-examples.rst | |
| parent | 3bc0ebab17bf5a2c29d2214743c82034f82e6573 (diff) | |
| download | cpython-8ca0fa9d2f4de6e69f0902790432e0ab2f37ba68.zip cpython-8ca0fa9d2f4de6e69f0902790432e0ab2f37ba68.tar.gz cpython-8ca0fa9d2f4de6e69f0902790432e0ab2f37ba68.tar.bz2 | |
bpo-35226: Fix equality for nested unittest.mock.call objects. (#10555)
Also refactor the call recording imolementation and add some notes
about its limitations.
Diffstat (limited to 'Doc/library/unittest.mock-examples.rst')
| -rw-r--r-- | Doc/library/unittest.mock-examples.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst index 60db4c2..16690f3 100644 --- a/Doc/library/unittest.mock-examples.rst +++ b/Doc/library/unittest.mock-examples.rst @@ -166,6 +166,15 @@ You use the :data:`call` object to construct lists for comparing with >>> mock.mock_calls == expected True +However, parameters to calls that return mocks are not recorded, which means it is not +possible to track nested calls where the parameters used to create ancestors are important: + + >>> m = Mock() + >>> m.factory(important=True).deliver() + <Mock name='mock.factory().deliver()' id='...'> + >>> m.mock_calls[-1] == call.factory(important=False).deliver() + True + Setting Return Values and Attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
