mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Add import of unittest.mock.Mock
in documentation (#102346)
This commit is contained in:
parent
7b9132057d
commit
cb944d0be8
1 changed files with 1 additions and 0 deletions
|
@ -72,6 +72,7 @@ available, and then make assertions about how they have been used:
|
|||
:attr:`side_effect` allows you to perform side effects, including raising an
|
||||
exception when a mock is called:
|
||||
|
||||
>>> from unittest.mock import Mock
|
||||
>>> mock = Mock(side_effect=KeyError('foo'))
|
||||
>>> mock()
|
||||
Traceback (most recent call last):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue