MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_func_16

Method test_func_16

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

Source from the content-addressed store, hash-verified

792
793 @unittest.expectedFailure # TODO: RUSTPYTHON; StopIteration
794 def test_func_16(self):
795 # See http://bugs.python.org/issue25887 for details
796
797 @types.coroutine
798 def nop():
799 yield
800 async def send():
801 await nop()
802 return 'spam'
803 async def read(coro):
804 await nop()
805 return await coro
806
807 spammer = send()
808
809 reader = read(spammer)
810 reader.send(None)
811 reader.send(None)
812 with self.assertRaisesRegex(Exception, 'ham'):
813 reader.throw(Exception('ham'))
814
815 reader = read(spammer)
816 reader.send(None)
817 with self.assertRaisesRegex(RuntimeError,
818 'cannot reuse already awaited coroutine'):
819 reader.send(None)
820
821 with self.assertRaisesRegex(RuntimeError,
822 'cannot reuse already awaited coroutine'):
823 reader.throw(Exception('wat'))
824
825 @unittest.expectedFailure # TODO: RUSTPYTHON; StopIteration
826 def test_func_17(self):

Callers

nothing calls this directly

Calls 5

sendFunction · 0.85
assertRaisesRegexMethod · 0.80
readFunction · 0.70
sendMethod · 0.45
throwMethod · 0.45

Tested by

no test coverage detected