]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#17539: fix MagicMock example. Patch by Berker Peksag.
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 30 Mar 2013 03:55:52 +0000 (05:55 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 30 Mar 2013 03:55:52 +0000 (05:55 +0200)
Doc/library/unittest.mock-examples.rst

index 0d136eb448495802b03b306c6e0da87d230379fc..d7d697d6509913e435fb780455d84113779e3b43 100644 (file)
@@ -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')