mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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:
parent
1db2ba3a92
commit
a125497ea3
6 changed files with 39 additions and 13 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue