Lines Matching defs:asyncio

11 import asyncio
12 from asyncio import futures
18 asyncio.set_event_loop_policy(None)
93 g = asyncio.wrap_future(f)
98 g = asyncio.ensure_future(f)
124 self.assertFalse(asyncio.isfuture(MyFuture))
125 self.assertTrue(asyncio.isfuture(MyFuture()))
126 self.assertFalse(asyncio.isfuture(1))
129 self.assertFalse(asyncio.isfuture(mock.Mock()))
132 self.assertTrue(asyncio.isfuture(f))
133 self.assertFalse(asyncio.isfuture(type(f)))
136 self.assertTrue(asyncio.isfuture(mock.Mock(type(f))))
160 asyncio.set_event_loop(self.loop)
161 self.addCleanup(asyncio.set_event_loop, None)
175 self.assertRaises(asyncio.InvalidStateError, fut.result)
178 self.assertRaises(asyncio.InvalidStateError, fut.exception)
228 with self.assertRaises(asyncio.CancelledError):
239 with self.assertRaises(asyncio.CancelledError):
248 self.assertRaises(asyncio.CancelledError, f.result)
249 self.assertRaises(asyncio.CancelledError, f.exception)
250 self.assertRaises(asyncio.InvalidStateError, f.set_result, None)
251 self.assertRaises(asyncio.InvalidStateError, f.set_exception, None)
256 self.assertRaises(asyncio.InvalidStateError, f.result)
263 self.assertRaises(asyncio.InvalidStateError, f.set_result, None)
264 self.assertRaises(asyncio.InvalidStateError, f.set_exception, None)
270 self.assertRaises(asyncio.InvalidStateError, f.exception)
281 self.assertRaises(asyncio.InvalidStateError, f.set_result, None)
282 self.assertRaises(asyncio.InvalidStateError, f.set_exception, None)
378 from asyncio.futures import _copy_future_state
421 @mock.patch('asyncio.base_events.logger')
427 @mock.patch('asyncio.base_events.logger')
435 @mock.patch('asyncio.base_events.logger')
442 @mock.patch('asyncio.base_events.logger')
450 @mock.patch('asyncio.base_events.logger')
459 @mock.patch('asyncio.base_events.logger')
467 @mock.patch('asyncio.base_events.logger')
481 f2 = asyncio.wrap_future(f1, loop=self.loop)
483 self.assertTrue(asyncio.isfuture(f2))
490 f2 = asyncio.wrap_future(f1)
499 asyncio.wrap_future(f1)
508 return asyncio.wrap_future(f1)
515 asyncio.set_event_loop(self.loop)
516 self.addCleanup(asyncio.set_event_loop, None)
521 f2 = asyncio.wrap_future(f1)
527 f2 = asyncio.wrap_future(f1, loop=self.loop)
535 f2 = asyncio.wrap_future(f1, loop=self.loop)
554 @mock.patch('asyncio.base_events.logger')