@@ -39,7 +39,7 @@ def __len__(self):
3939class TestTaskPoolExecutor :
4040 @pytest .mark .parametrize ("as_awaitable" , [False , True ])
4141 async def test_submit (self , executor , as_awaitable ):
42- future = await submit (executor , as_awaitable , amul , 2 , 8 )
42+ future = submit (executor , as_awaitable , amul , 2 , 8 )
4343 assert await future == 16
4444 assert future .result () == 16
4545
@@ -49,11 +49,11 @@ async def acapture(*args, **kwargs):
4949 await asyncio .sleep (0.01 )
5050 return args , kwargs
5151
52- future = await submit (executor , as_awaitable , amul , 2 , y = 8 )
52+ future = submit (executor , as_awaitable , amul , 2 , y = 8 )
5353 assert await future == 16
5454 assert future .result () == 16
5555
56- future = await submit (executor , as_awaitable , acapture , 1 , self = 2 , fn = 3 )
56+ future = submit (executor , as_awaitable , acapture , 1 , self = 2 , fn = 3 )
5757 assert await future == ((1 ,), {"self" : 2 , "fn" : 3 })
5858 assert future .result () == ((1 ,), {"self" : 2 , "fn" : 3 })
5959
@@ -85,22 +85,20 @@ async def test_submit_awaitable_error(self, executor, args, kwargs):
8585 coro = amul (2 , 8 )
8686 try :
8787 with pytest .raises (TypeError , match = error ):
88- await executor .submit (coro , * args , ** kwargs )
88+ executor .submit (coro , * args , ** kwargs )
8989 finally :
9090 coro .close ()
9191
9292 @pytest .mark .parametrize ("as_awaitable" , [False , True ])
9393 async def test_exception (self , executor , as_awaitable ):
94- future = await submit (executor , as_awaitable , adivmod , 2 , 0 )
94+ future = submit (executor , as_awaitable , adivmod , 2 , 0 )
9595 with pytest .raises (ZeroDivisionError ) as exc_info :
9696 await future
9797 assert future .exception () is exc_info .value
9898
9999 @pytest .mark .parametrize ("as_awaitable" , [False , True ])
100100 async def test_cancellation (self , executor , as_awaitable ):
101- future = await submit (
102- executor , as_awaitable , adivmod , 2 , 0 , cancel_if_zero = True
103- )
101+ future = submit (executor , as_awaitable , adivmod , 2 , 0 , cancel_if_zero = True )
104102 with pytest .raises (asyncio .CancelledError ):
105103 await future
106104 assert future .cancelled ()
@@ -180,7 +178,7 @@ async def test_no_stale_references(self, executor, as_awaitable):
180178 my_object_collected = asyncio .Event ()
181179 my_object_callback = weakref .ref (my_object , lambda _ : my_object_collected .set ())
182180 # Deliberately discarding the future.
183- await submit (executor , as_awaitable , my_object .my_method )
181+ submit (executor , as_awaitable , my_object .my_method )
184182 del my_object
185183 try :
186184 await asyncio .wait_for (my_object_collected .wait (), timeout = 1.0 )
@@ -195,7 +193,7 @@ def test_max_workers_negative(self):
195193
196194 @pytest .mark .parametrize ("as_awaitable" , [False , True ])
197195 async def test_free_future_reference (self , executor , as_awaitable ):
198- future = await submit (executor , as_awaitable , MyObject .create , 1 )
196+ future = submit (executor , as_awaitable , MyObject .create , 1 )
199197 await future
200198
201199 wr = weakref .ref (future )
@@ -228,7 +226,7 @@ async def araise(exception):
228226 raise exception
229227
230228 msg = "falsy"
231- future = await submit (executor , as_awaitable , araise , exc_type (msg ))
229+ future = submit (executor , as_awaitable , araise , exc_type (msg ))
232230 with pytest .raises (exc_type , match = msg ):
233231 await future
234232
@@ -251,16 +249,16 @@ def test_default_workers(self):
251249 async def test_saturation (self , executor , as_awaitable ):
252250 sem = asyncio .Semaphore (0 )
253251 for _ in range (15 * executor ._max_workers ):
254- await submit (executor , as_awaitable , sem .acquire )
252+ submit (executor , as_awaitable , sem .acquire )
255253 assert len (executor ._tasks ) == executor ._max_workers
256254 for _ in range (15 * executor ._max_workers ):
257255 sem .release ()
258256
259257 @pytest .mark .parametrize ("as_awaitable" , [False , True ])
260258 async def test_idle_worker_reuse (self , executor , as_awaitable ):
261- assert await ( await submit (executor , as_awaitable , amul , 21 , 2 ) ) == 42
262- assert await ( await submit (executor , as_awaitable , amul , 6 , 7 ) ) == 42
263- assert await ( await submit (executor , as_awaitable , amul , 3 , 14 ) ) == 42
259+ assert await submit (executor , as_awaitable , amul , 21 , 2 ) == 42
260+ assert await submit (executor , as_awaitable , amul , 6 , 7 ) == 42
261+ assert await submit (executor , as_awaitable , amul , 3 , 14 ) == 42
264262 assert len (executor ._tasks ) == 1
265263
266264 @pytest .mark .parametrize ("as_awaitable" , [False , True ])
@@ -277,7 +275,7 @@ async def log_n_wait(ident):
277275
278276 async with TaskPoolExecutor (max_workers = 1 ) as executor :
279277 # submit work to saturate the pool
280- fut = await submit (executor , as_awaitable , log_n_wait , ident = "first" )
278+ fut = submit (executor , as_awaitable , log_n_wait , ident = "first" )
281279 try :
282280 agen = await executor .map (log_n_wait , ["second" , "third" ])
283281 with pytest .raises (TimeoutError ):
0 commit comments