@@ -57,7 +57,7 @@ async def doit():
5757 return 'hello'
5858
5959 with contextlib .closing (asyncio .new_event_loop ()) as loop :
60- asyncio ._set_event_loop (loop )
60+ asyncio .set_event_loop (loop )
6161 return loop .run_until_complete (doit ())
6262
6363
@@ -2830,14 +2830,6 @@ async def inner():
28302830
28312831class PolicyTests (unittest .TestCase ):
28322832
2833- def test_asyncio_set_event_loop_deprecation (self ):
2834- with self .assertWarnsRegex (
2835- DeprecationWarning , "'asyncio.set_event_loop' is deprecated" ):
2836- loop = asyncio .new_event_loop ()
2837- asyncio .set_event_loop (loop )
2838- self .assertIs (loop , asyncio .get_event_loop ())
2839- loop .close ()
2840-
28412833 def test_abstract_event_loop_policy_deprecation (self ):
28422834 with self .assertWarnsRegex (
28432835 DeprecationWarning , "'asyncio.AbstractEventLoopPolicy' is deprecated" ):
@@ -2974,14 +2966,14 @@ def setUp(self):
29742966 super ().setUp ()
29752967
29762968 self .loop = asyncio .new_event_loop ()
2977- asyncio ._set_event_loop (self .loop )
2969+ asyncio .set_event_loop (self .loop )
29782970
29792971 def tearDown (self ):
29802972 try :
29812973 super ().tearDown ()
29822974 finally :
29832975 self .loop .close ()
2984- asyncio ._set_event_loop (None )
2976+ asyncio .set_event_loop (None )
29852977
29862978 events ._get_running_loop = self ._get_running_loop_saved
29872979 events ._set_running_loop = self ._set_running_loop_saved
@@ -3053,7 +3045,7 @@ def get_event_loop(self):
30533045
30543046 with self .assertRaises (TestError ):
30553047 asyncio .get_event_loop ()
3056- asyncio ._set_event_loop (None )
3048+ asyncio .set_event_loop (None )
30573049 with self .assertRaises (TestError ):
30583050 asyncio .get_event_loop ()
30593051
@@ -3068,10 +3060,10 @@ async def func():
30683060
30693061 loop .run_until_complete (func ())
30703062
3071- asyncio ._set_event_loop (loop )
3063+ asyncio .set_event_loop (loop )
30723064 with self .assertRaises (TestError ):
30733065 asyncio .get_event_loop ()
3074- asyncio ._set_event_loop (None )
3066+ asyncio .set_event_loop (None )
30753067 with self .assertRaises (TestError ):
30763068 asyncio .get_event_loop ()
30773069
@@ -3095,7 +3087,7 @@ def test_get_event_loop_returns_running_loop2(self):
30953087 with self .assertRaisesRegex (RuntimeError , 'no current' ):
30963088 asyncio .get_event_loop ()
30973089
3098- asyncio ._set_event_loop (None )
3090+ asyncio .set_event_loop (None )
30993091 with self .assertRaisesRegex (RuntimeError , 'no current' ):
31003092 asyncio .get_event_loop ()
31013093
@@ -3106,10 +3098,10 @@ async def func():
31063098
31073099 loop .run_until_complete (func ())
31083100
3109- asyncio ._set_event_loop (loop )
3101+ asyncio .set_event_loop (loop )
31103102 self .assertIs (asyncio .get_event_loop (), loop )
31113103
3112- asyncio ._set_event_loop (None )
3104+ asyncio .set_event_loop (None )
31133105 with self .assertRaisesRegex (RuntimeError , 'no current' ):
31143106 asyncio .get_event_loop ()
31153107
0 commit comments