I'm using MagicMock with Python 3.4 to mock a function under test, I will then assert that the function is being called with correct arguments.
However, I want to perform a special kind of comparison on some of the call arguments. Is there a way for me to iterate through the call args and apply my own special function on some of them / all of them?
As of now the only way I know how to use call arg is by doing:
# from unittest.mock import call
assert mock_function.call_arg_list[0] == call(1, 2, keyword_arg=an_object)
I'd like to perform a special kind of comparison on the keyword_arg and if possible non-keyword parameters as well.
Aucun commentaire:
Enregistrer un commentaire