summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-11-17 17:19:41 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-11-17 17:19:41 (GMT)
commit5d7e3b6cd208dffdfe8530664081b62e0c7e3092 (patch)
treeb6c746197f3d33280a3c99261e0f7288611f97cf /Lib/test/test_asyncio
parent0013ccedd1e9dd829a5966afc71c2363604b011d (diff)
downloadcpython-5d7e3b6cd208dffdfe8530664081b62e0c7e3092.zip
cpython-5d7e3b6cd208dffdfe8530664081b62e0c7e3092.tar.gz
cpython-5d7e3b6cd208dffdfe8530664081b62e0c7e3092.tar.bz2
asyncio: Cleanup Future API
See https://github.com/python/asyncio/pull/292 for details.
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_futures.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
index 0bc0581..55fdff3 100644
--- a/Lib/test/test_asyncio/test_futures.py
+++ b/Lib/test/test_asyncio/test_futures.py
@@ -174,11 +174,13 @@ class FutureTests(test_utils.TestCase):
'<Future cancelled>')
def test_copy_state(self):
+ from asyncio.futures import _copy_future_state
+
f = asyncio.Future(loop=self.loop)
f.set_result(10)
newf = asyncio.Future(loop=self.loop)
- newf._copy_state(f)
+ _copy_future_state(f, newf)
self.assertTrue(newf.done())
self.assertEqual(newf.result(), 10)
@@ -186,7 +188,7 @@ class FutureTests(test_utils.TestCase):
f_exception.set_exception(RuntimeError())
newf_exception = asyncio.Future(loop=self.loop)
- newf_exception._copy_state(f_exception)
+ _copy_future_state(f_exception, newf_exception)
self.assertTrue(newf_exception.done())
self.assertRaises(RuntimeError, newf_exception.result)
@@ -194,7 +196,7 @@ class FutureTests(test_utils.TestCase):
f_cancelled.cancel()
newf_cancelled = asyncio.Future(loop=self.loop)
- newf_cancelled._copy_state(f_cancelled)
+ _copy_future_state(f_cancelled, newf_cancelled)
self.assertTrue(newf_cancelled.cancelled())
def test_iter(self):
@@ -382,9 +384,10 @@ class FutureTests(test_utils.TestCase):
self.check_future_exception_never_retrieved(True)
def test_set_result_unless_cancelled(self):
+ from asyncio import futures
fut = asyncio.Future(loop=self.loop)
fut.cancel()
- fut._set_result_unless_cancelled(2)
+ futures._set_result_unless_cancelled(fut, 2)
self.assertTrue(fut.cancelled())