I want to patch get_age()
method I have, based on the argument passed.
Let's say I have get_age.py
where I am using multiple times the same get_age()
method.
get_age("Anna")
...
get_age("Ben")
and then in test I want to do:
@patch('get_ages.get_age') <-- mock getting age of Ben
@patch('get_ages.get_age') <-- mock getting age of Anna
def test_get_ages(self, age_A, age_B):
How can I do the mocking of the same method based on the name passed? Thanks!