I'm using the mock library and unittest2 in order to test different aspects of my software project.
At the moment I have the following question: is it possible to mock a function so that the default keyword argument is different, but the functionality remains?
Say I have the following code
class C():
def fun(self, bool_arg = True):
if bool_arg:
return True
else
return False
What if I want to mock C.fun:
C.fun = mock.Mock(???)
so that every instance of C will replace keyword 'bool_arg' with False, instead of True and the result of:
c = C()
c.fun()
returns:
False