asyncio, Tulip issue 126: call_soon(), call_soon_threadsafe(), call_later(),

call_at() and run_in_executor() now raise a TypeError if the callback is a
coroutine function.
This commit is contained in:
Victor Stinner 2014-02-11 11:34:30 +01:00
parent 1db2ba3a92
commit a125497ea3
6 changed files with 39 additions and 13 deletions

View file

@ -44,8 +44,8 @@ class BaseSelectorEventLoopTests(unittest.TestCase):
def test_make_socket_transport(self):
m = unittest.mock.Mock()
self.loop.add_reader = unittest.mock.Mock()
self.assertIsInstance(
self.loop._make_socket_transport(m, m), _SelectorSocketTransport)
transport = self.loop._make_socket_transport(m, asyncio.Protocol())
self.assertIsInstance(transport, _SelectorSocketTransport)
@unittest.skipIf(ssl is None, 'No ssl module')
def test_make_ssl_transport(self):
@ -54,8 +54,9 @@ class BaseSelectorEventLoopTests(unittest.TestCase):
self.loop.add_writer = unittest.mock.Mock()
self.loop.remove_reader = unittest.mock.Mock()
self.loop.remove_writer = unittest.mock.Mock()
self.assertIsInstance(
self.loop._make_ssl_transport(m, m, m, m), _SelectorSslTransport)
waiter = asyncio.Future(loop=self.loop)
transport = self.loop._make_ssl_transport(m, asyncio.Protocol(), m, waiter)
self.assertIsInstance(transport, _SelectorSslTransport)
@unittest.mock.patch('asyncio.selector_events.ssl', None)
def test_make_ssl_transport_without_ssl_error(self):