I want to be able to have multiple calls to a particular attribute function return a different result for each successive call.
In the below example, I would like increm
I tested and this should work
import mock
...
...
@mock.patch.object(ClassB, 'method_2')
@mock.patch.object(ClassA, 'method_1')
def test_same_method_multi_return_value(self, method_1, method_2):
# type: () -> None
method_1.return_value = 'Static value'
method_1.side_effect = [
'Value called by first time'
'Value called by second time'
'...'
]
Version
https://mock.readthedocs.io/en/latest/
mock>=2.0.0,<3.0