Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b14592 commit b40a220Copy full SHA for b40a220
1 file changed
Doc/library/unittest.mock-examples.rst
@@ -324,11 +324,11 @@ with.
324
...
325
>>> test()
326
327
-If you are patching a module (including `__builtin__`) then use `patch`
+If you are patching a module (including :mod:`builtins`) then use `patch`
328
instead of `patch.object`:
329
330
- >>> mock = MagicMock(return_value = sentinel.file_handle)
331
- >>> with patch('__builtin__.open', mock):
+ >>> mock = MagicMock(return_value=sentinel.file_handle)
+ >>> with patch('builtins.open', mock):
332
... handle = open('filename', 'r')
333
334
>>> mock.assert_called_with('filename', 'r')
0 commit comments