After performing an action, you can make assertions about which methods / attributes were used and arguments they were called with. You can also specify return values and set specific attributes in the normal way. It also provides a mock.patch() decorator that handles patching module and class level attributes within the scope of a test, along with mock.sentinel for creating unique objects. Most mocking libraries follow the 'record -> replay' pattern of mocking. Mock uses the 'action -> assertion' pattern, which is more readable and intuitive; particularly when working with the Python unit test module.
LicenseFree
File Size186.39 kB
Version0.7.0 beta
Operating System Linux