Message228303
One of the use cases for side_effect is for dynamically changing the returned value based on input - so your option 1 just doesn't work.
Using two line functions would make your code easier to read, and then your "workarounds" would look natural instead of awkward.
Maybe return_value should take precedence over side_effect if both are set.
It would probably be more pythonic to raise an exception in that case - although that would be annoying if you're just reconfiguring a mock. I've also written side_effect functions that accessed the return_value, which is probably the genesis of the current API.
As you point out, both your suggested changes are backwards incompatible, so I'm closing this issue. |
|
Date |
User |
Action |
Args |
2014-10-03 03:48:28 | michael.foord | set | recipients:
+ michael.foord, r.david.murray, Dima.Tisnek |
2014-10-03 03:48:28 | michael.foord | set | messageid: <1412308108.33.0.275307826369.issue22541@psf.upfronthosting.co.za> |
2014-10-03 03:48:28 | michael.foord | link | issue22541 messages |
2014-10-03 03:48:27 | michael.foord | create | |
|