MCPcopy Index your code
hub / github.com/RustPython/RustPython / assert_awaited_once_with

Method assert_awaited_once_with

Lib/unittest/mock.py:2389–2398  ·  view source on GitHub ↗

Assert that the mock was awaited exactly once and with the specified arguments.

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

Source from the content-addressed store, hash-verified

2387 raise AssertionError(_error_message()) from cause
2388
2389 def assert_awaited_once_with(self, /, *args, **kwargs):
2390 """
2391 Assert that the mock was awaited exactly once and with the specified
2392 arguments.
2393 """
2394 if not self.await_count == 1:
2395 msg = (f"Expected {self._mock_name or 'mock'} to have been awaited once."
2396 f" Awaited {self.await_count} times.")
2397 raise AssertionError(msg)
2398 return self.assert_awaited_with(*args, **kwargs)
2399
2400 def assert_any_await(self, /, *args, **kwargs):
2401 """

Callers 4

test_create_autospecMethod · 0.80
test_asyncMethod · 0.80

Calls 1

assert_awaited_withMethod · 0.95

Tested by 4

test_create_autospecMethod · 0.64
test_asyncMethod · 0.64