I am using python's unittest.Mock framework.
I want to achieve following goal with mock:
The original method is like:
def mymethod(para1, para2, para3):
return para1 + para2 + para3
I want to mock it to return the first para1 - discard the rest:
def mymethod(para1, para2, para3):
return para1
I saw we can set return_value of a mocked object, but seems only a hardcoded one. I saw we can get the parameters of a mocked call, but only after that is called. - is there a way to get the parameter and return it dynamically?