assert that the mock was called exactly once and that call was with the specified arguments.
(self, /, *args, **kwargs)
| 987 | |
| 988 | |
| 989 | def assert_called_once_with(self, /, *args, **kwargs): |
| 990 | """assert that the mock was called exactly once and that call was |
| 991 | with the specified arguments.""" |
| 992 | if not self.call_count == 1: |
| 993 | msg = ("Expected '%s' to be called once. Called %s times.%s" |
| 994 | % (self._mock_name or 'mock', |
| 995 | self.call_count, |
| 996 | self._calls_repr())) |
| 997 | raise AssertionError(msg) |
| 998 | return self.assert_called_with(*args, **kwargs) |
| 999 | |
| 1000 | |
| 1001 | def assert_has_calls(self, calls, any_order=False): |