MCPcopy Index your code
hub / github.com/python/cpython / test_func_5

Method test_func_5

Lib/test/test_coroutines.py:595–617  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

assertRaisesRegexMethod · 0.80
fooFunction · 0.70
checkFunction · 0.70
barFunction · 0.50
closeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected