(self)
| 593 | coro.close() |
| 594 | |
| 595 | def test_func_5(self): |
| 596 | @types.coroutine |
| 597 | def bar(): |
| 598 | yield 1 |
| 599 | |
| 600 | async def foo(): |
| 601 | await bar() |
| 602 | |
| 603 | check = lambda: self.assertRaisesRegex( |
| 604 | TypeError, "'coroutine' object is not iterable") |
| 605 | |
| 606 | coro = foo() |
| 607 | with check(): |
| 608 | for el in coro: |
| 609 | pass |
| 610 | coro.close() |
| 611 | |
| 612 | # the following should pass without an error |
| 613 | for el in bar(): |
| 614 | self.assertEqual(el, 1) |
| 615 | self.assertEqual([el for el in bar()], [1]) |
| 616 | self.assertEqual(tuple(bar()), (1,)) |
| 617 | self.assertEqual(next(iter(bar())), 1) |
| 618 | |
| 619 | def test_func_6(self): |
| 620 | @types.coroutine |
nothing calls this directly
no test coverage detected