diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-11-22 01:47:08 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-11-22 01:47:08 +0100 |
commit | d26183452f1e00fac38ad28d3817803605f884d6 (patch) | |
tree | b6829a1acb94630f0501a385dec57275d5a59e29 /tests | |
parent | 469de722a85bb08cc665ebd60c6cc0385d0c4ae9 (diff) | |
download | aioeventlet-d26183452f1e00fac38ad28d3817803605f884d6.tar.gz |
link_future() only accepts coroutine objects, not coroutine functions
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_eventlet.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_eventlet.py b/tests/test_eventlet.py index 2361e81..4a8970c 100644 --- a/tests/test_eventlet.py +++ b/tests/test_eventlet.py @@ -234,6 +234,23 @@ class LinkFutureTests(tests.TestCase): self.loop.run_forever() self.assertEqual(result, ['error']) + def test_link_future_invalid_type(self): + def func(obj): + return aiogreen.link_future(obj) + + @asyncio.coroutine + def coro_func(): + print("do something") + + def regular_func(): + return 3 + + for obj in (coro_func, regular_func): + gt = eventlet.spawn(func, coro_func) + # ignore logged traceback + with tests.mock.patch('traceback.print_exception') as m_print: + self.assertRaises(TypeError, gt.wait) + def test_link_future_wrong_loop(self): result = [] loop2 = asyncio.new_event_loop() |