diff options
| author | Yury Selivanov <yury@magic.io> | 2016-11-03 22:10:11 (GMT) |
|---|---|---|
| committer | Yury Selivanov <yury@magic.io> | 2016-11-03 22:10:11 (GMT) |
| commit | a6fbcd19ac3e821f53159d06d643de65c70c1050 (patch) | |
| tree | 28b50212ab2cffb284283decd633106da17809f7 /Lib/test | |
| parent | 4948a462e82fce85e94e12bf47b7a14aef2dc466 (diff) | |
| parent | 491a912659a4aeb57c400f37b8059fa1ef7bed73 (diff) | |
| download | cpython-a6fbcd19ac3e821f53159d06d643de65c70c1050.zip cpython-a6fbcd19ac3e821f53159d06d643de65c70c1050.tar.gz cpython-a6fbcd19ac3e821f53159d06d643de65c70c1050.tar.bz2 | |
Merge 3.5 (issue #28600)
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_asyncio/test_base_events.py | 36 | ||||
| -rw-r--r-- | Lib/test/test_asyncio/test_events.py | 7 |
2 files changed, 8 insertions, 35 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index a9aba0f..3913125 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -235,6 +235,11 @@ class BaseEventLoopTests(test_utils.TestCase): self.assertIsInstance(h, asyncio.Handle) self.assertIn(h, self.loop._ready) + def test_call_soon_non_callable(self): + self.loop.set_debug(True) + with self.assertRaisesRegex(TypeError, 'a callable object'): + self.loop.call_soon(1) + def test_call_later(self): def cb(): pass @@ -341,47 +346,21 @@ class BaseEventLoopTests(test_utils.TestCase): # check disabled if debug mode is disabled test_thread(self.loop, False, create_loop=True) - def test_run_once_in_executor_handle(self): - def cb(): - pass - - self.assertRaises( - AssertionError, self.loop.run_in_executor, - None, asyncio.Handle(cb, (), self.loop), ('',)) - self.assertRaises( - AssertionError, self.loop.run_in_executor, - None, asyncio.TimerHandle(10, cb, (), self.loop)) - - def test_run_once_in_executor_cancelled(self): - def cb(): - pass - h = asyncio.Handle(cb, (), self.loop) - h.cancel() - - with self.assertWarnsRegex(DeprecationWarning, "Passing Handle"): - f = self.loop.run_in_executor(None, h) - self.assertIsInstance(f, asyncio.Future) - self.assertTrue(f.done()) - self.assertIsNone(f.result()) - def test_run_once_in_executor_plain(self): def cb(): pass - h = asyncio.Handle(cb, (), self.loop) f = asyncio.Future(loop=self.loop) executor = mock.Mock() executor.submit.return_value = f self.loop.set_default_executor(executor) - with self.assertWarnsRegex(DeprecationWarning, "Passing Handle"): - res = self.loop.run_in_executor(None, h) + res = self.loop.run_in_executor(None, cb) self.assertIs(f, res) executor = mock.Mock() executor.submit.return_value = f - with self.assertWarnsRegex(DeprecationWarning, "Passing Handle"): - res = self.loop.run_in_executor(executor, h) + res = self.loop.run_in_executor(executor, cb) self.assertIs(f, res) self.assertTrue(executor.submit.called) @@ -1666,6 +1645,7 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase): def simple_coroutine(): pass + self.loop.set_debug(True) coro_func = simple_coroutine coro_obj = coro_func() self.addCleanup(coro_obj.close) diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 7df926f..d8946e3 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -2249,13 +2249,6 @@ class HandleTests(test_utils.TestCase): h.cancel() self.assertTrue(h._cancelled) - def test_handle_from_handle(self): - def callback(*args): - return args - h1 = asyncio.Handle(callback, (), loop=self.loop) - self.assertRaises( - AssertionError, asyncio.Handle, h1, (), self.loop) - def test_callback_with_exception(self): def callback(): raise ValueError() |
