<p>If in your tests you want to return different values when calling the same function use <code>side_effect</code> instead of <code>return_value</code> like this: <code>mock_func.side_effect = [return_value1, return_value2]</code></p>
By clicking “Accept cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage and assist in our marketing efforts. Check our privacy policies.
By clicking “Accept all”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage and assist in our marketing efforts. Check our privacy policies.