@@ -162,15 +162,9 @@ def mock_tool_invoke(
162
162
def test_sync_client_initialization_and_loop_management ():
163
163
"""Tests that the event loop and thread are managed correctly at class level."""
164
164
client1 = ToolboxSyncClient (TEST_BASE_URL )
165
- assert (
166
- client1 ._ToolboxSyncClient__loop is not None
167
- ), "Loop should be created"
168
- assert (
169
- client1 ._ToolboxSyncClient__thread is not None
170
- ), "Thread should be created"
171
- assert (
172
- client1 ._ToolboxSyncClient__thread .is_alive ()
173
- ), "Thread should be running"
165
+ assert client1 ._ToolboxSyncClient__loop is not None , "Loop should be created"
166
+ assert client1 ._ToolboxSyncClient__thread is not None , "Thread should be created"
167
+ assert client1 ._ToolboxSyncClient__thread .is_alive (), "Thread should be running"
174
168
assert isinstance (
175
169
client1 ._ToolboxSyncClient__async_client , ToolboxClient
176
170
), "Async client should be ToolboxClient instance"
@@ -180,9 +174,7 @@ def test_sync_client_initialization_and_loop_management():
180
174
181
175
client2 = ToolboxSyncClient (TEST_BASE_URL ) # Should reuse existing loop/thread
182
176
assert client2 ._ToolboxSyncClient__loop is loop1 , "Loop should be reused"
183
- assert (
184
- client2 ._ToolboxSyncClient__thread is thread1
185
- ), "Thread should be reused"
177
+ assert client2 ._ToolboxSyncClient__thread is thread1 , "Thread should be reused"
186
178
assert isinstance (client2 ._ToolboxSyncClient__async_client , ToolboxClient )
187
179
188
180
client1 .close () # Closes its async_client's session
@@ -471,7 +463,6 @@ def expected_header_token(self): # Renamed to avoid clash
471
463
def tool_name_auth (self ): # Renamed
472
464
return "sync_auth_tool1"
473
465
474
-
475
466
def test_auth_with_load_tool_success (
476
467
self ,
477
468
tool_name_auth ,
@@ -489,7 +480,9 @@ def test_auth_with_load_tool_success(
489
480
)
490
481
491
482
def require_headers_callback (url , ** kwargs ):
492
- assert kwargs ["headers" ].get ("my-auth-service_token" ) == expected_header_token
483
+ assert (
484
+ kwargs ["headers" ].get ("my-auth-service_token" ) == expected_header_token
485
+ )
493
486
return CallbackResult (status = 200 , payload = {"result" : "auth_ok" })
494
487
495
488
aioresponses .post (
@@ -526,7 +519,9 @@ def test_auth_with_add_token_success(
526
519
)
527
520
528
521
def require_headers_callback (url , ** kwargs ):
529
- assert kwargs ["headers" ].get ("my-auth-service_token" ) == expected_header_token
522
+ assert (
523
+ kwargs ["headers" ].get ("my-auth-service_token" ) == expected_header_token
524
+ )
530
525
return CallbackResult (status = 200 , payload = {"result" : "auth_ok" })
531
526
532
527
aioresponses .post (
@@ -575,7 +570,8 @@ def test_auth_with_load_tool_fail_no_token(
575
570
tool = client .load_tool (tool_name_auth )
576
571
# Invocation should fail
577
572
with pytest .raises (
578
- ValueError , match = "One or more of the following authn services are required to invoke this tool: my-auth-service"
573
+ ValueError ,
574
+ match = "One or more of the following authn services are required to invoke this tool: my-auth-service" ,
579
575
): # Match error from server
580
576
tool (argA = 15 , argB = True )
581
577
0 commit comments