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