PyDocs

Nav

Development Tools

Mock.side_effect

unittest.mock

attribute of Mock (source)
This can either be a function to be called when the mock is called, an iterable or an exception (class or instance) to be raised.
1 Example
>>> mock = Mock()
>>> mock.side_effect = Exception('Boom!')
>>> mock()
Traceback (most recent call last):
  ...
Exception: Boom!
from the Python docs
See Also
No see-alsos for unittest.mock/Mock.side_effect
0 Notes
No notes for Mock.side_effect