MCPcopy Index your code
hub / github.com/python/cpython / assert_called_once

Method assert_called_once

Lib/unittest/mock.py:957–965  ·  view source on GitHub ↗

assert that the mock was called only once.

(self)

Source from the content-addressed store, hash-verified

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.

Calls 1

_calls_reprMethod · 0.95