diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-03-30 03:55:52 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-03-30 03:55:52 (GMT) |
commit | b40a2203adff6511afc65fe885816636e135c935 (patch) | |
tree | ee3f1b7d1dafbc0b7848dc2105ff2b15f6dd805c /Doc/library | |
parent | 1b145927d725b136b987df220dff0ec7529b6f29 (diff) | |
download | cpython-b40a2203adff6511afc65fe885816636e135c935.zip cpython-b40a2203adff6511afc65fe885816636e135c935.tar.gz cpython-b40a2203adff6511afc65fe885816636e135c935.tar.bz2 |
#17539: fix MagicMock example. Patch by Berker Peksag.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/unittest.mock-examples.rst | 6 |
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') |