Skip to content

Commit 270d061

Browse files
committed
fix: Remove properties exposing internal state from sync tool
1 parent 041792e commit 270d061

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

packages/toolbox-core/src/toolbox_core/sync_tool.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,6 @@ def __init__(
6868
f"{self.__class__.__qualname__}.{self.__async_tool.__name__}"
6969
)
7070

71-
@property
72-
def _async_tool(self) -> ToolboxTool:
73-
return self.__async_tool
74-
75-
@property
76-
def _loop(self) -> AbstractEventLoop:
77-
return self.__loop
78-
79-
@property
80-
def _thread(self) -> Thread:
81-
return self.__thread
82-
8371
@property
8472
def __name__(self) -> str:
8573
return self.__async_tool.__name__

packages/toolbox-core/tests/test_sync_client.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -235,41 +235,6 @@ def test_sync_load_toolset_success(
235235
assert result1 == f"{TOOL1_NAME}_ok"
236236

237237

238-
def test_sync_tool_internal_properties(aioresponses, tool_schema_minimal, sync_client):
239-
"""
240-
Tests that the internal properties _async_tool, _loop, and _thread
241-
of a ToolboxSyncTool instance are correctly initialized and accessible.
242-
This directly covers the respective @property methods in ToolboxSyncTool.
243-
"""
244-
TOOL_NAME = "test_tool_for_internal_properties"
245-
mock_tool_load(aioresponses, TOOL_NAME, tool_schema_minimal)
246-
247-
loaded_sync_tool = sync_client.load_tool(TOOL_NAME)
248-
249-
assert isinstance(loaded_sync_tool, ToolboxSyncTool)
250-
251-
# 1. Test the _async_tool property
252-
internal_async_tool = loaded_sync_tool._async_tool
253-
assert isinstance(internal_async_tool, ToolboxTool)
254-
assert internal_async_tool.__name__ == TOOL_NAME
255-
256-
# 2. Test the _loop property
257-
internal_loop = loaded_sync_tool._loop
258-
assert isinstance(internal_loop, AbstractEventLoop)
259-
assert internal_loop is sync_client._ToolboxSyncClient__loop
260-
assert (
261-
internal_loop.is_running()
262-
), "The event loop used by ToolboxSyncTool should be running."
263-
264-
# 3. Test the _thread property
265-
internal_thread = loaded_sync_tool._thread
266-
assert isinstance(internal_thread, Thread)
267-
assert internal_thread is sync_client._ToolboxSyncClient__thread
268-
assert (
269-
internal_thread.is_alive()
270-
), "The thread used by ToolboxSyncTool should be alive."
271-
272-
273238
def test_sync_invoke_tool_server_error(aioresponses, test_tool_str_schema, sync_client):
274239
TOOL_NAME = "sync_server_error_tool"
275240
ERROR_MESSAGE = "Simulated Server Error for Sync Client"

0 commit comments

Comments
 (0)