[Python-checkins] cpython (3.3): #17539: fix MagicMock example. Patch by Berker Peksag.
ezio.melotti
python-checkins at python.org
Sat Mar 30 04:56:32 CET 2013
http://hg.python.org/cpython/rev/b0c0a03b8033
changeset: 83010:b0c0a03b8033
branch: 3.3
parent: 83008:39e103c1577e
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Sat Mar 30 05:55:52 2013 +0200
summary:
#17539: fix MagicMock example. Patch by Berker Peksag.
files:
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
--- a/Doc/library/unittest.mock-examples.rst
+++ b/Doc/library/unittest.mock-examples.rst
@@ -324,11 +324,11 @@
...
>>> 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')
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list