(self)
| 242 | self.assertIs(f, f_orig) |
| 243 | |
| 244 | def test_ensure_future_task(self): |
| 245 | async def notmuch(): |
| 246 | return 'ok' |
| 247 | t_orig = self.new_task(self.loop, notmuch()) |
| 248 | t = asyncio.ensure_future(t_orig) |
| 249 | self.loop.run_until_complete(t) |
| 250 | self.assertTrue(t.done()) |
| 251 | self.assertEqual(t.result(), 'ok') |
| 252 | self.assertIs(t, t_orig) |
| 253 | |
| 254 | loop = asyncio.new_event_loop() |
| 255 | self.set_event_loop(loop) |
| 256 | |
| 257 | with self.assertRaises(ValueError): |
| 258 | t = asyncio.ensure_future(t_orig, loop=loop) |
| 259 | |
| 260 | loop.close() |
| 261 | |
| 262 | t = asyncio.ensure_future(t_orig, loop=self.loop) |
| 263 | self.assertIs(t, t_orig) |
| 264 | |
| 265 | def test_ensure_future_awaitable(self): |
| 266 | class Aw: |
nothing calls this directly
no test coverage detected