mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Update unittest.mock.patch example
This commit is contained in:
parent
aa8ec7e076
commit
324b58bf18
1 changed files with 2 additions and 2 deletions
|
@ -988,10 +988,10 @@ patch
|
|||
the decorated function:
|
||||
|
||||
>>> @patch('__main__.SomeClass')
|
||||
... def function(mock_class):
|
||||
... def function(normal_argument, mock_class):
|
||||
... print(mock_class is SomeClass)
|
||||
...
|
||||
>>> function()
|
||||
>>> function(None)
|
||||
True
|
||||
|
||||
Patching a class replaces the class with a `MagicMock` *instance*. If the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue