Message354770
This would be nice to integrate an assert_not_called_with feature.
I had to implement it to test a publish/subscribe patterns where multiple subscibers got called but not with the same arguments.
Here is my implementation:
```
def assert_not_called_with(self, *args, **kwargs):
"""assert that the mock was never called with the specified arguments.
"""
try:
self.assert_called_with(*args, **kwargs)
except AssertionError:
return
raise AssertionError(
"Expected %s to not have been called."
% self._format_mock_call_signature(args, kwargs)
)
```
An alternative would had been to iterate the call_args_list but it wouldn't result in a clean one-line assert
coming from: https://github.com/testing-cabal/mock/issues/473 |
|
Date |
User |
Action |
Args |
2019-10-16 06:22:50 | valkheim | set | recipients:
+ valkheim |
2019-10-16 06:22:50 | valkheim | set | messageid: <1571206970.26.0.707248566898.issue38494@roundup.psfhosted.org> |
2019-10-16 06:22:50 | valkheim | link | issue38494 messages |
2019-10-16 06:22:50 | valkheim | create | |
|