Assert that the last await was with the specified arguments.
(self, /, *args, **kwargs)
| 2376 | raise AssertionError(msg) |
| 2377 | |
| 2378 | def assert_awaited_with(self, /, *args, **kwargs): |
| 2379 | """ |
| 2380 | Assert that the last await was with the specified arguments. |
| 2381 | """ |
| 2382 | if self.await_args is None: |
| 2383 | expected = self._format_mock_call_signature(args, kwargs) |
| 2384 | raise AssertionError(f'Expected await: {expected}\nNot awaited') |
| 2385 | |
| 2386 | def _error_message(): |
| 2387 | msg = self._format_mock_failure_message(args, kwargs, action='await') |
| 2388 | return msg |
| 2389 | |
| 2390 | expected = self._call_matcher(_Call((args, kwargs), two=True)) |
| 2391 | actual = self._call_matcher(self.await_args) |
| 2392 | if actual != expected: |
| 2393 | cause = expected if isinstance(expected, Exception) else None |
| 2394 | raise AssertionError(_error_message()) from cause |
| 2395 | |
| 2396 | def assert_awaited_once_with(self, /, *args, **kwargs): |
| 2397 | """ |