@@ -30,35 +30,35 @@ class TestToolboxClient:
30
30
def toolbox_client (self ):
31
31
client = ToolboxClient (URL )
32
32
assert isinstance (client , ToolboxClient )
33
- assert client ._ToolboxClient__core_sync_client is not None
34
- assert client ._ToolboxClient__core_sync_client ._async_client is not None
35
- assert client ._ToolboxClient__core_sync_client ._loop is not None
36
- assert client ._ToolboxClient__core_sync_client ._loop .is_running ()
37
- assert client ._ToolboxClient__core_sync_client ._thread is not None
38
- assert client ._ToolboxClient__core_sync_client ._thread .is_alive ()
33
+ assert client ._ToolboxClient__core_client is not None
34
+ assert client ._ToolboxClient__core_client ._async_client is not None
35
+ assert client ._ToolboxClient__core_client ._loop is not None
36
+ assert client ._ToolboxClient__core_client ._loop .is_running ()
37
+ assert client ._ToolboxClient__core_client ._thread is not None
38
+ assert client ._ToolboxClient__core_client ._thread .is_alive ()
39
39
return client
40
40
41
41
@patch ("toolbox_core.sync_client.ToolboxSyncClient.load_tool" )
42
42
def test_load_tool (self , mock_core_load_tool , toolbox_client ):
43
- mock_core_sync_tool_instance = Mock (
43
+ mock_core_tool_instance = Mock (
44
44
spec = ToolboxCoreSyncTool
45
45
) # Spec with Core Sync Tool
46
- mock_core_sync_tool_instance .__name__ = "mock-core-sync-tool"
47
- mock_core_sync_tool_instance .__doc__ = "mock core sync description"
46
+ mock_core_tool_instance .__name__ = "mock-core-sync-tool"
47
+ mock_core_tool_instance .__doc__ = "mock core sync description"
48
48
49
49
mock_underlying_async_tool = Mock (
50
50
spec = ToolboxCoreTool
51
51
) # Core Async Tool for pydantic model
52
52
mock_underlying_async_tool ._pydantic_model = BaseModel
53
- mock_core_sync_tool_instance ._async_tool = mock_underlying_async_tool
53
+ mock_core_tool_instance ._async_tool = mock_underlying_async_tool
54
54
55
- mock_core_load_tool .return_value = mock_core_sync_tool_instance
55
+ mock_core_load_tool .return_value = mock_core_tool_instance
56
56
57
57
langchain_tool = toolbox_client .load_tool ("test_tool" )
58
58
59
59
assert isinstance (langchain_tool , ToolboxTool )
60
- assert langchain_tool .name == mock_core_sync_tool_instance .__name__
61
- assert langchain_tool .description == mock_core_sync_tool_instance .__doc__
60
+ assert langchain_tool .name == mock_core_tool_instance .__name__
61
+ assert langchain_tool .description == mock_core_tool_instance .__doc__
62
62
assert langchain_tool .args_schema == mock_underlying_async_tool ._pydantic_model
63
63
64
64
mock_core_load_tool .assert_called_once_with (
@@ -67,23 +67,23 @@ def test_load_tool(self, mock_core_load_tool, toolbox_client):
67
67
68
68
@patch ("toolbox_core.sync_client.ToolboxSyncClient.load_toolset" )
69
69
def test_load_toolset (self , mock_core_load_toolset , toolbox_client ):
70
- mock_core_sync_tool_instance1 = Mock (spec = ToolboxCoreSyncTool )
71
- mock_core_sync_tool_instance1 .__name__ = "mock-core-sync-tool-0"
72
- mock_core_sync_tool_instance1 .__doc__ = "desc 0"
70
+ mock_core_tool_instance1 = Mock (spec = ToolboxCoreSyncTool )
71
+ mock_core_tool_instance1 .__name__ = "mock-core-sync-tool-0"
72
+ mock_core_tool_instance1 .__doc__ = "desc 0"
73
73
mock_async_tool0 = Mock (spec = ToolboxCoreTool )
74
74
mock_async_tool0 ._pydantic_model = BaseModel
75
- mock_core_sync_tool_instance1 ._async_tool = mock_async_tool0
75
+ mock_core_tool_instance1 ._async_tool = mock_async_tool0
76
76
77
- mock_core_sync_tool_instance2 = Mock (spec = ToolboxCoreSyncTool )
78
- mock_core_sync_tool_instance2 .__name__ = "mock-core-sync-tool-1"
79
- mock_core_sync_tool_instance2 .__doc__ = "desc 1"
77
+ mock_core_tool_instance2 = Mock (spec = ToolboxCoreSyncTool )
78
+ mock_core_tool_instance2 .__name__ = "mock-core-sync-tool-1"
79
+ mock_core_tool_instance2 .__doc__ = "desc 1"
80
80
mock_async_tool1 = Mock (spec = ToolboxCoreTool )
81
81
mock_async_tool1 ._pydantic_model = BaseModel
82
- mock_core_sync_tool_instance2 ._async_tool = mock_async_tool1
82
+ mock_core_tool_instance2 ._async_tool = mock_async_tool1
83
83
84
84
mock_core_load_toolset .return_value = [
85
- mock_core_sync_tool_instance1 ,
86
- mock_core_sync_tool_instance2 ,
85
+ mock_core_tool_instance1 ,
86
+ mock_core_tool_instance2 ,
87
87
]
88
88
89
89
langchain_tools = toolbox_client .load_toolset ()
@@ -114,7 +114,7 @@ async def test_aload_tool(self, mock_core_aload_tool, toolbox_client):
114
114
assert langchain_tool .name == mock_core_tool_instance .__name__
115
115
assert langchain_tool .description == mock_core_tool_instance .__doc__
116
116
117
- toolbox_client ._ToolboxClient__core_sync_client ._async_client .load_tool .assert_called_once_with (
117
+ toolbox_client ._ToolboxClient__core_client ._async_client .load_tool .assert_called_once_with (
118
118
name = "test_tool" , auth_token_getters = {}, bound_params = {}
119
119
)
120
120
@@ -145,18 +145,18 @@ async def test_aload_toolset(self, mock_core_aload_toolset, toolbox_client):
145
145
assert isinstance (langchain_tools [0 ], ToolboxTool )
146
146
assert isinstance (langchain_tools [1 ], ToolboxTool )
147
147
148
- toolbox_client ._ToolboxClient__core_sync_client ._async_client .load_toolset .assert_called_once_with (
148
+ toolbox_client ._ToolboxClient__core_client ._async_client .load_toolset .assert_called_once_with (
149
149
name = None , auth_token_getters = {}, bound_params = {}, strict = False
150
150
)
151
151
152
152
@patch ("toolbox_core.sync_client.ToolboxSyncClient.load_tool" )
153
153
def test_load_tool_with_args (self , mock_core_load_tool , toolbox_client ):
154
- mock_core_sync_tool_instance = Mock (spec = ToolboxCoreSyncTool )
155
- mock_core_sync_tool_instance .__name__ = "mock-tool"
154
+ mock_core_tool_instance = Mock (spec = ToolboxCoreSyncTool )
155
+ mock_core_tool_instance .__name__ = "mock-tool"
156
156
mock_async_tool = Mock (spec = ToolboxCoreTool )
157
157
mock_async_tool ._pydantic_model = BaseModel
158
- mock_core_sync_tool_instance ._async_tool = mock_async_tool
159
- mock_core_load_tool .return_value = mock_core_sync_tool_instance
158
+ mock_core_tool_instance ._async_tool = mock_async_tool
159
+ mock_core_load_tool .return_value = mock_core_tool_instance
160
160
161
161
auth_token_getters = {"token_getter1" : lambda : "value1" }
162
162
auth_tokens_deprecated = {"token_deprecated" : lambda : "value_dep" }
@@ -216,12 +216,12 @@ def test_load_tool_with_args(self, mock_core_load_tool, toolbox_client):
216
216
217
217
@patch ("toolbox_core.sync_client.ToolboxSyncClient.load_toolset" )
218
218
def test_load_toolset_with_args (self , mock_core_load_toolset , toolbox_client ):
219
- mock_core_sync_tool_instance = Mock (spec = ToolboxCoreSyncTool )
220
- mock_core_sync_tool_instance .__name__ = "mock-tool-0"
219
+ mock_core_tool_instance = Mock (spec = ToolboxCoreSyncTool )
220
+ mock_core_tool_instance .__name__ = "mock-tool-0"
221
221
mock_async_tool = Mock (spec = ToolboxCoreTool )
222
222
mock_async_tool ._pydantic_model = BaseModel
223
- mock_core_sync_tool_instance ._async_tool = mock_async_tool
224
- mock_core_load_toolset .return_value = [mock_core_sync_tool_instance ]
223
+ mock_core_tool_instance ._async_tool = mock_async_tool
224
+ mock_core_load_toolset .return_value = [mock_core_tool_instance ]
225
225
226
226
auth_token_getters = {"token_getter1" : lambda : "value1" }
227
227
auth_tokens_deprecated = {"token_deprecated" : lambda : "value_dep" }
@@ -277,7 +277,7 @@ async def test_aload_tool_with_args(self, mock_core_aload_tool, toolbox_client):
277
277
assert any ("auth_headers` is deprecated" in m for m in messages )
278
278
279
279
assert isinstance (tool , ToolboxTool )
280
- toolbox_client ._ToolboxClient__core_sync_client ._async_client .load_tool .assert_called_with (
280
+ toolbox_client ._ToolboxClient__core_client ._async_client .load_tool .assert_called_with (
281
281
name = "test_tool" ,
282
282
auth_token_getters = auth_token_getters ,
283
283
bound_params = bound_params ,
@@ -313,7 +313,7 @@ async def test_aload_toolset_with_args(
313
313
assert any ("auth_headers` is deprecated" in m for m in messages )
314
314
315
315
assert len (tools ) == 1
316
- toolbox_client ._ToolboxClient__core_sync_client ._async_client .load_toolset .assert_called_with (
316
+ toolbox_client ._ToolboxClient__core_client ._async_client .load_toolset .assert_called_with (
317
317
name = "my_toolset" ,
318
318
auth_token_getters = auth_token_getters ,
319
319
bound_params = bound_params ,
0 commit comments