@@ -84,9 +84,9 @@ async def get_state():
8484
8585 assert not errors , f"Errors occurred: { errors } "
8686 assert len (states ) == 3
87- assert (
88- len ( set ( id ( s ) for s in states )) == 3
89- ), "States should be unique per thread"
87+ assert len ( set ( id ( s ) for s in states )) == 3 , (
88+ "States should be unique per thread"
89+ )
9090
9191
9292class TestIssue149HandleExitSignaling :
@@ -162,9 +162,9 @@ async def wait_for_exit(task_id: int):
162162 except asyncio .CancelledError :
163163 pass
164164
165- assert (
166- len (exited ) == num_tasks
167- ), f"Only { len ( exited ) } / { num_tasks } tasks woke up."
165+ assert len ( exited ) == num_tasks , (
166+ f"Only { len (exited )} / { num_tasks } tasks woke up."
167+ )
168168
169169 @pytest .mark .asyncio
170170 async def test_manual_shutdown_ignores_signal (self ):
@@ -184,14 +184,14 @@ async def wait_for_exit():
184184 AppStatus .original_handler = None
185185 AppStatus .handle_exit ()
186186 await asyncio .sleep (1.0 )
187- assert (
188- not task_exited . is_set ()
189- ), "Task woke up despite automatic signaling being disabled."
187+ assert not task_exited . is_set (), (
188+ "Task woke up despite automatic signaling being disabled."
189+ )
190190 AppStatus .should_exit = True # Manually signal shutdown
191191 await asyncio .wait ([task ], timeout = 1.0 )
192- assert (
193- task_exited . is_set ()
194- ), "Task did not wake up after manual shutdown signal."
192+ assert task_exited . is_set (), (
193+ "Task did not wake up after manual shutdown signal."
194+ )
195195 finally :
196196 AppStatus .enable_automatic_graceful_drain = original_drain
197197 AppStatus .original_handler = original_handler
@@ -258,7 +258,9 @@ async def wait_for_exit():
258258 # If the uvicorn check weren't bypassed, task would wake up
259259 await asyncio .sleep (1.0 )
260260
261- assert not task_exited .is_set (), "Task woke up from uvicorn.should_exit despite auto-drain being disabled."
261+ assert not task_exited .is_set (), (
262+ "Task woke up from uvicorn.should_exit despite auto-drain being disabled."
263+ )
262264
263265 # Now manually signal shutdown
264266 AppStatus .should_exit = True
0 commit comments