I have a function A that call another function B several times. I want to mock B in such a way that any number of calls that have the correct number of arguments, regardless of value, will return a fixed vale and be treated as correct.
If or how many times the the function is called is not a part of the spec.
Stub out B normally....
Assuming B accepts 2 arguments and should return 'foo':
B(mox.IgnoreArg(), mox.IgnoreArg()).MultipleTimes().AndReturn('foo')
def B(*args, **kwds):
return 'fixed value'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With