python unittest mock method code example
Example 1: python unittest mock
>>> real = SomeClass()
>>> real.method = MagicMock(name='method')
>>> real.method(3, 4, 5, key='value')
<MagicMock name='method()' id='...'>
Example 2: python unittest mock
>>> class ProductionClass:
... def closer(self, something):
... something.close()
...