(self)
| 189 | self.assertEqual(to_list(gen()), [123, 456, 789]) |
| 190 | |
| 191 | def test_async_gen_iteration_02(self): |
| 192 | async def gen(): |
| 193 | await awaitable() |
| 194 | yield 123 |
| 195 | await awaitable() |
| 196 | |
| 197 | g = gen() |
| 198 | ai = g.__aiter__() |
| 199 | |
| 200 | an = ai.__anext__() |
| 201 | self.assertEqual(an.__next__(), ('result',)) |
| 202 | |
| 203 | try: |
| 204 | an.__next__() |
| 205 | except StopIteration as ex: |
| 206 | self.assertEqual(ex.args[0], 123) |
| 207 | else: |
| 208 | self.fail('StopIteration was not raised') |
| 209 | |
| 210 | an = ai.__anext__() |
| 211 | self.assertEqual(an.__next__(), ('result',)) |
| 212 | |
| 213 | try: |
| 214 | an.__next__() |
| 215 | except StopAsyncIteration as ex: |
| 216 | self.assertFalse(ex.args) |
| 217 | else: |
| 218 | self.fail('StopAsyncIteration was not raised') |
| 219 | |
| 220 | def test_async_gen_exception_03(self): |
| 221 | async def gen(): |
nothing calls this directly
no test coverage detected