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