15
15
16
16
import inspect
17
17
import json
18
+ from unittest .mock import AsyncMock
18
19
19
20
import pytest
20
21
import pytest_asyncio
21
22
from aioresponses import CallbackResult
22
- from unittest .mock import AsyncMock
23
-
24
23
from toolbox_core import ToolboxClient
25
24
from toolbox_core .protocol import ManifestSchema , ParameterSchema , ToolSchema
26
25
@@ -331,16 +330,21 @@ async def test_new_invoke_tool_server_error(aioresponses, test_tool_str):
331
330
332
331
333
332
@pytest .mark .asyncio
334
- async def test_bind_param_async_callable_value_success (aioresponses , test_tool_int_bool ):
333
+ async def test_bind_param_async_callable_value_success (
334
+ aioresponses , test_tool_int_bool
335
+ ):
335
336
"""
336
337
Tests bind_parameters method with an async callable value.
337
338
"""
338
339
TOOL_NAME = "async_bind_tool"
339
- manifest = ManifestSchema (serverVersion = "0.0.0" , tools = {TOOL_NAME : test_tool_int_bool })
340
+ manifest = ManifestSchema (
341
+ serverVersion = "0.0.0" , tools = {TOOL_NAME : test_tool_int_bool }
342
+ )
340
343
341
344
aioresponses .get (
342
345
f"{ TEST_BASE_URL } /api/tool/{ TOOL_NAME } " ,
343
- payload = manifest .model_dump (), status = 200
346
+ payload = manifest .model_dump (),
347
+ status = 200 ,
344
348
)
345
349
346
350
def reflect_parameters (url , ** kwargs ):
@@ -381,7 +385,8 @@ async def test_new_add_auth_token_getters_duplicate_fail(aioresponses, test_tool
381
385
382
386
aioresponses .get (
383
387
f"{ TEST_BASE_URL } /api/tool/{ TOOL_NAME } " ,
384
- payload = manifest .model_dump (), status = 200
388
+ payload = manifest .model_dump (),
389
+ status = 200 ,
385
390
)
386
391
387
392
def token_handler_1 ():
@@ -396,5 +401,8 @@ def token_handler_2():
396
401
authed_tool = tool .add_auth_token_getters ({AUTH_SERVICE : token_handler_1 })
397
402
assert AUTH_SERVICE in authed_tool ._ToolboxTool__auth_service_token_getters
398
403
399
- with pytest .raises (ValueError , match = f"Authentication source\\ (s\\ ) `{ AUTH_SERVICE } ` already registered in tool `{ TOOL_NAME } `." ):
400
- authed_tool .add_auth_token_getters ({AUTH_SERVICE : token_handler_2 })
404
+ with pytest .raises (
405
+ ValueError ,
406
+ match = f"Authentication source\\ (s\\ ) `{ AUTH_SERVICE } ` already registered in tool `{ TOOL_NAME } `." ,
407
+ ):
408
+ authed_tool .add_auth_token_getters ({AUTH_SERVICE : token_handler_2 })
0 commit comments