This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: side_effects swapped in Mock example
Type: Stage: resolved
Components: Documentation Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: chris-buccella, docs@python, eric.araujo, python-dev
Priority: normal Keywords:

Created on 2014-03-17 20:34 by chris-buccella, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg213891 - (view) Author: (chris-buccella) Date: 2014-03-17 20:34
http://docs.python.org/3.4/library/unittest.mock-examples.html

Section 26.5.3.9. Mocking a dictionary with MagicMock

In the Note area:

>>> mock.__setitem__ = Mock(side_effect=getitem)
>>> mock.__getitem__ = Mock(side_effect=setitem)


I think these are swapped; should be:

>>> mock.__setitem__ = Mock(side_effect=setitem)
>>> mock.__getitem__ = Mock(side_effect=getitem)
msg213893 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-17 20:46
Thanks, will fix.
msg213894 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-17 20:50
New changeset e725de5a2760 by Éric Araujo in branch '3.4':
Fix typo in example (#20963)
http://hg.python.org/cpython/rev/e725de5a2760
History
Date User Action Args
2022-04-11 14:58:00adminsetgithub: 65162
2014-03-17 20:51:50eric.araujosetstatus: open -> closed
resolution: fixed
stage: resolved
2014-03-17 20:50:58python-devsetnosy: + python-dev
messages: + msg213894
2014-03-17 20:46:29eric.araujosetassignee: docs@python -> eric.araujo

messages: + msg213893
nosy: + eric.araujo
2014-03-17 20:34:47chris-buccellacreate