in testslide/mock_callable.py [0:0]
def add_at_most_calls_assertion(self, times: int) -> None:
self._set_max_calls(times)
def assertion() -> None:
if not self.call_count or self.call_count > times:
raise AssertionError(
(
"calls did not match assertion.\n"
"{}, {}:\n"
" expected: called at most {} time(s) with {}"
" received: {} call(s)"
).format(
_format_target(self.target),
repr(self.method),
times,
self._args_message(),
self.call_count,
)
)
register_assertion(assertion)