diff options
| author | Brett Cannon <brett@python.org> | 2013-11-22 19:53:07 (GMT) |
|---|---|---|
| committer | Brett Cannon <brett@python.org> | 2013-11-22 19:53:07 (GMT) |
| commit | df38a80abaef73aee7148c28aca4f46de77e40b4 (patch) | |
| tree | cc21b9ed066a26735a91bedea74ba1faa3f4869e /Lib/test/test_asyncio/test_futures.py | |
| parent | 224b26125818056f5d38e2806a1c26fd91ab869c (diff) | |
| parent | 7a465647e47957e95acc3ae0f84d945b0c47707d (diff) | |
| download | cpython-df38a80abaef73aee7148c28aca4f46de77e40b4.zip cpython-df38a80abaef73aee7148c28aca4f46de77e40b4.tar.gz cpython-df38a80abaef73aee7148c28aca4f46de77e40b4.tar.bz2 | |
merge
Diffstat (limited to 'Lib/test/test_asyncio/test_futures.py')
| -rw-r--r-- | Lib/test/test_asyncio/test_futures.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index ccea2ff..e35fcf0 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -241,6 +241,24 @@ class FutureTests(unittest.TestCase): f2 = futures.wrap_future(f1) self.assertIs(m_events.get_event_loop.return_value, f2._loop) + def test_wrap_future_cancel(self): + f1 = concurrent.futures.Future() + f2 = futures.wrap_future(f1, loop=self.loop) + f2.cancel() + test_utils.run_briefly(self.loop) + self.assertTrue(f1.cancelled()) + self.assertTrue(f2.cancelled()) + + def test_wrap_future_cancel2(self): + f1 = concurrent.futures.Future() + f2 = futures.wrap_future(f1, loop=self.loop) + f1.set_result(42) + f2.cancel() + test_utils.run_briefly(self.loop) + self.assertFalse(f1.cancelled()) + self.assertEqual(f1.result(), 42) + self.assertTrue(f2.cancelled()) + class FutureDoneCallbackTests(unittest.TestCase): |
