Staging: this is not the live site, pydocs.org.
unittest.mock unittest.mock is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used. © Python Software Foundation. PSF License Version 2 · Official docs ↗
Symbols in unittest.mock a AsyncMock Enhance :class:`Mock` with features allowing to mock an async function. c call call() is a helper object for making simpler assertions, for comparing with call_args, call_args_list, mock_calls and method_calls. d DEFAULT The DEFAULT object is a pre-created sentinel (actually sentinel.DEFAULT). m MagicMock MagicMock is a subclass of Mock with default implementations of most of the magic methods. Mock Create a new `Mock` object. mock_open A helper function to create a mock to replace the use of `open`. p patch `patch` acts as a function decorator, class decorator or a context manager. PropertyMock A mock intended to be used as a property, or other descriptor, on a class. s seal Disable the automatic generation of child mocks. sentinel The sentinel object provides a convenient way of providing unique objects for your tests. t ThreadingMock A mock that can be used to wait until on calls happening in a different thread.
Python docs © Python Software Foundation · Examples CC0 ·
Source on GitHub · Not affiliated with the PSF