unittest.mock python code example
Example 1: python unittest mock
>>> class ProductionClass:
... def closer(self, something):
... something.close()
...
Example 2: python unittest mock
>>> real = ProductionClass()
>>> mock = Mock()
>>> real.closer(mock)
>>> mock.close.assert_called_with()