(self)
| 783 | self.loop.run_until_complete(call_with_kwarg()) |
| 784 | |
| 785 | def test_anext_bad_await(self): |
| 786 | async def bad_awaitable(): |
| 787 | class BadAwaitable: |
| 788 | def __await__(self): |
| 789 | return 42 |
| 790 | class MyAsyncIter: |
| 791 | def __aiter__(self): |
| 792 | return self |
| 793 | def __anext__(self): |
| 794 | return BadAwaitable() |
| 795 | regex = r"__await__.*iterator" |
| 796 | awaitable = anext(MyAsyncIter(), "default") |
| 797 | with self.assertRaisesRegex(TypeError, regex): |
| 798 | await awaitable |
| 799 | awaitable = anext(MyAsyncIter()) |
| 800 | with self.assertRaisesRegex(TypeError, regex): |
| 801 | await awaitable |
| 802 | return "completed" |
| 803 | result = self.loop.run_until_complete(bad_awaitable()) |
| 804 | self.assertEqual(result, "completed") |
| 805 | |
| 806 | async def check_anext_returning_iterator(self, aiter_class): |
| 807 | awaitable = anext(aiter_class(), "default") |
nothing calls this directly
no test coverage detected