aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_events.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2017-12-11 10:07:44 -0500
committerGitHub <noreply@github.com>2017-12-11 10:07:44 -0500
commitabae67ebc2897ca37df067f322d19e19d1ef6d88 (patch)
tree065b5ae2fbb3a206f7b337d3a8ae8b83b566f3c1 /Lib/test/test_asyncio/test_events.py
parent3e9751819ad13a965e8be13c1e5bc5a6811fe6b8 (diff)
downloadcpython-abae67ebc2897ca37df067f322d19e19d1ef6d88.tar.gz
cpython-abae67ebc2897ca37df067f322d19e19d1ef6d88.zip
Add asyncio.get_running_loop() function. (#4782)
Diffstat (limited to 'Lib/test/test_asyncio/test_events.py')
-rw-r--r--Lib/test/test_asyncio/test_events.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index 39d5bb54a9d..1315febe403 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -2733,10 +2733,13 @@ class PolicyTests(unittest.TestCase):
try:
asyncio.set_event_loop_policy(Policy())
loop = asyncio.new_event_loop()
+ with self.assertRaisesRegex(RuntimeError, 'no running'):
+ self.assertIs(asyncio.get_running_loop(), None)
self.assertIs(asyncio._get_running_loop(), None)
async def func():
self.assertIs(asyncio.get_event_loop(), loop)
+ self.assertIs(asyncio.get_running_loop(), loop)
self.assertIs(asyncio._get_running_loop(), loop)
loop.run_until_complete(func())
@@ -2745,6 +2748,9 @@ class PolicyTests(unittest.TestCase):
if loop is not None:
loop.close()
+ with self.assertRaisesRegex(RuntimeError, 'no running'):
+ self.assertIs(asyncio.get_running_loop(), None)
+
self.assertIs(asyncio._get_running_loop(), None)