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

Method test_func_17

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

Source from the content-addressed store, hash-verified

818 reader.throw(Exception('wat'))
819
820 def test_func_17(self):
821 # See http://bugs.python.org/issue25887 for details
822
823 async def coroutine():
824 return 'spam'
825
826 coro = coroutine()
827 with self.assertRaisesRegex(StopIteration, 'spam'):
828 coro.send(None)
829
830 with self.assertRaisesRegex(RuntimeError,
831 'cannot reuse already awaited coroutine'):
832 coro.send(None)
833
834 with self.assertRaisesRegex(RuntimeError,
835 'cannot reuse already awaited coroutine'):
836 coro.throw(Exception('wat'))
837
838 # Closing a coroutine shouldn't raise any exception even if it's
839 # already closed/exhausted (similar to generators)
840 coro.close()
841 coro.close()
842
843 def test_func_18(self):
844 # See http://bugs.python.org/issue25887 for details

Callers

nothing calls this directly

Calls 5

coroutineFunction · 0.85
assertRaisesRegexMethod · 0.80
sendMethod · 0.45
throwMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected