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

Method assert_called_once_with

Lib/unittest/mock.py:989–998  ·  view source on GitHub ↗

assert that the mock was called exactly once and that call was with the specified arguments.

(self, /, *args, **kwargs)

Source from the content-addressed store, hash-verified

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):

Calls 2

_calls_reprMethod · 0.95
assert_called_withMethod · 0.95