summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-03-30 03:55:52 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-03-30 03:55:52 (GMT)
commitb40a2203adff6511afc65fe885816636e135c935 (patch)
treeee3f1b7d1dafbc0b7848dc2105ff2b15f6dd805c /Doc
parent1b145927d725b136b987df220dff0ec7529b6f29 (diff)
downloadcpython-b40a2203adff6511afc65fe885816636e135c935.zip
cpython-b40a2203adff6511afc65fe885816636e135c935.tar.gz
cpython-b40a2203adff6511afc65fe885816636e135c935.tar.bz2
#17539: fix MagicMock example. Patch by Berker Peksag.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/unittest.mock-examples.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst
index 0d136eb..d7d697d 100644
--- a/Doc/library/unittest.mock-examples.rst
+++ b/Doc/library/unittest.mock-examples.rst
@@ -324,11 +324,11 @@ with.
...
>>> test()
-If you are patching a module (including `__builtin__`) then use `patch`
+If you are patching a module (including :mod:`builtins`) then use `patch`
instead of `patch.object`:
- >>> mock = MagicMock(return_value = sentinel.file_handle)
- >>> with patch('__builtin__.open', mock):
+ >>> mock = MagicMock(return_value=sentinel.file_handle)
+ >>> with patch('builtins.open', mock):
... handle = open('filename', 'r')
...
>>> mock.assert_called_with('filename', 'r')