diff options
author | Yury Selivanov <yury@magic.io> | 2016-10-24 02:34:35 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-10-24 02:34:35 (GMT) |
commit | 01c521ba7a06a5dc18c814faef740d01666c7af5 (patch) | |
tree | 4f1e4abc701996b22c16cea8fd77378955a63c5f /Lib/asyncio/futures.py | |
parent | 89850314761cc755393ddac35989113f07681de0 (diff) | |
download | cpython-01c521ba7a06a5dc18c814faef740d01666c7af5.zip cpython-01c521ba7a06a5dc18c814faef740d01666c7af5.tar.gz cpython-01c521ba7a06a5dc18c814faef740d01666c7af5.tar.bz2 |
asyncio: Increase asyncio.Future test coverage; test both implementations.
Also, add 'isfuture' to 'asyncio.futures.__all__', so that it's
exposed as 'asyncio.isfuture'.
Diffstat (limited to 'Lib/asyncio/futures.py')
-rw-r--r-- | Lib/asyncio/futures.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index e45d6aa..b571130 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -2,7 +2,7 @@ __all__ = ['CancelledError', 'TimeoutError', 'InvalidStateError', - 'Future', 'wrap_future', + 'Future', 'wrap_future', 'isfuture' ] import concurrent.futures._base @@ -389,6 +389,10 @@ class Future: __await__ = __iter__ # make compatible with 'await' expression +# Needed for testing purposes. +_PyFuture = Future + + def _set_result_unless_cancelled(fut, result): """Helper setting the result only if the future was not cancelled.""" if fut.cancelled(): @@ -488,4 +492,5 @@ try: except ImportError: pass else: - Future = _asyncio.Future + # _CFuture is needed for tests. + Future = _CFuture = _asyncio.Future |