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

Method test_task_class

Lib/test/test_asyncio/test_tasks.py:175–190  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

173 self.loop.run_until_complete(task)
174
175 def test_task_class(self):
176 async def notmuch():
177 return 'ok'
178 t = self.new_task(self.loop, notmuch())
179 self.loop.run_until_complete(t)
180 self.assertTrue(t.done())
181 self.assertEqual(t.result(), 'ok')
182 self.assertIs(t._loop, self.loop)
183 self.assertIs(t.get_loop(), self.loop)
184
185 loop = asyncio.new_event_loop()
186 self.set_event_loop(loop)
187 t = self.new_task(loop, notmuch())
188 self.assertIs(t._loop, loop)
189 loop.run_until_complete(t)
190 loop.close()
191
192 def test_ensure_future_coroutine(self):
193 async def notmuch():

Callers

nothing calls this directly

Calls 11

new_taskMethod · 0.95
assertTrueMethod · 0.80
run_until_completeMethod · 0.45
doneMethod · 0.45
assertEqualMethod · 0.45
resultMethod · 0.45
assertIsMethod · 0.45
get_loopMethod · 0.45
new_event_loopMethod · 0.45
set_event_loopMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected