summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_tasks.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-11 10:34:30 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-02-11 10:34:30 (GMT)
commita125497ea302aff937a5c59f98c39dba4f1ab59b (patch)
tree3c4ef537c6bba46a544fefabae9b59c60a289c1b /Lib/test/test_asyncio/test_tasks.py
parent1db2ba3a92a435e871800612a14a9dfc9e760fab (diff)
downloadcpython-a125497ea302aff937a5c59f98c39dba4f1ab59b.zip
cpython-a125497ea302aff937a5c59f98c39dba4f1ab59b.tar.gz
cpython-a125497ea302aff937a5c59f98c39dba4f1ab59b.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_asyncio/test_tasks.py')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 9abdfa5..29bdaf5 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -2,8 +2,6 @@
import gc
import unittest
-import unittest.mock
-from unittest.mock import Mock
import asyncio
from asyncio import test_utils
@@ -1358,7 +1356,7 @@ class GatherTestsBase:
def _check_success(self, **kwargs):
a, b, c = [asyncio.Future(loop=self.one_loop) for i in range(3)]
fut = asyncio.gather(*self.wrap_futures(a, b, c), **kwargs)
- cb = Mock()
+ cb = test_utils.MockCallback()
fut.add_done_callback(cb)
b.set_result(1)
a.set_result(2)
@@ -1380,7 +1378,7 @@ class GatherTestsBase:
def test_one_exception(self):
a, b, c, d, e = [asyncio.Future(loop=self.one_loop) for i in range(5)]
fut = asyncio.gather(*self.wrap_futures(a, b, c, d, e))
- cb = Mock()
+ cb = test_utils.MockCallback()
fut.add_done_callback(cb)
exc = ZeroDivisionError()
a.set_result(1)
@@ -1399,7 +1397,7 @@ class GatherTestsBase:
a, b, c, d = [asyncio.Future(loop=self.one_loop) for i in range(4)]
fut = asyncio.gather(*self.wrap_futures(a, b, c, d),
return_exceptions=True)
- cb = Mock()
+ cb = test_utils.MockCallback()
fut.add_done_callback(cb)
exc = ZeroDivisionError()
exc2 = RuntimeError()
@@ -1460,7 +1458,7 @@ class FutureGatherTests(GatherTestsBase, unittest.TestCase):
def test_one_cancellation(self):
a, b, c, d, e = [asyncio.Future(loop=self.one_loop) for i in range(5)]
fut = asyncio.gather(a, b, c, d, e)
- cb = Mock()
+ cb = test_utils.MockCallback()
fut.add_done_callback(cb)
a.set_result(1)
b.cancel()
@@ -1479,7 +1477,7 @@ class FutureGatherTests(GatherTestsBase, unittest.TestCase):
a, b, c, d, e, f = [asyncio.Future(loop=self.one_loop)
for i in range(6)]
fut = asyncio.gather(a, b, c, d, e, f, return_exceptions=True)
- cb = Mock()
+ cb = test_utils.MockCallback()
fut.add_done_callback(cb)
a.set_result(1)
zde = ZeroDivisionError()