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

Method assert_any_await

Lib/unittest/mock.py:2407–2418  ·  view source on GitHub ↗

Assert the mock has ever been awaited with the specified arguments.

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

Source from the content-addressed store, hash-verified

2405 return self.assert_awaited_with(*args, **kwargs)
2406
2407 def assert_any_await(self, /, *args, **kwargs):
2408 """
2409 Assert the mock has ever been awaited with the specified arguments.
2410 """
2411 expected = self._call_matcher(_Call((args, kwargs), two=True))
2412 cause = expected if isinstance(expected, Exception) else None
2413 actual = [self._call_matcher(c) for c in self.await_args_list]
2414 if cause or expected not in _AnyComparer(actual):
2415 expected_string = self._format_mock_call_signature(args, kwargs)
2416 raise AssertionError(
2417 '%s await not found' % expected_string
2418 ) from cause
2419
2420 def assert_has_awaits(self, calls, any_order=False):
2421 """

Calls 4

_CallClass · 0.85
_AnyComparerClass · 0.85
_call_matcherMethod · 0.80