assert that the mock was called only once.
(self)
| 955 | raise AssertionError(msg) |
| 956 | |
| 957 | def assert_called_once(self): |
| 958 | """assert that the mock was called only once. |
| 959 | """ |
| 960 | if not self.call_count == 1: |
| 961 | msg = ("Expected '%s' to have been called once. Called %s times.%s" |
| 962 | % (self._mock_name or 'mock', |
| 963 | self.call_count, |
| 964 | self._calls_repr())) |
| 965 | raise AssertionError(msg) |
| 966 | |
| 967 | def assert_called_with(self, /, *args, **kwargs): |
| 968 | """assert that the last call was made with the specified arguments. |