I am using Mock (http://mock.readthedocs.org/en/latest/) library with Python 2.7. I have a main function that calls a few other functions that I am trying to test.
The other functions that it calls are other instance methods (so for example, def _other_function(self, a, b).
I am calling my main function, and I have the other functions that it calls patched. I just added autospec=True to the patch. When I check for call arguments however, it shows a self argument (as expected):
python2.7> _other_function_mock.call_args_list
[call(<some.module.class.method object at 0x9acab90>, 1, 2)]
Before setting autospec=True, it would only show that arguments that I actually passed (1 and 2). Since now the call args show a reference to self, I can't just call mock_object.assert_any_call(1, 2). I will need to pick out the arguments from mock_object.call_args_list and compare.
Is there a way to still call mock.assert_any_call without having to pick out the arguments manually to check that the arguments passed are correct?
Or is there something better in general that I can do to patch instance methods?