Python Mocking with unitest.mock 2
Jump to navigation
Jump to search
Internal
Mocking a Method
The general approach is to replace at runtime the real method instance associated with the class instance to be tested with a Mock
instance, configured to simulate various behaviors of the real method.
Assuming there is a class SomeClass
that has a method some_method()
whose behavior we want to simulate during testing