Skip to content

Commit d333849

Browse files
committed
chore: Update unit test case
1 parent a271f0a commit d333849

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

packages/toolbox-core/tests/test_client.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,15 +378,23 @@ async def test_bind_callable_param_success(self, tool_name, client):
378378
assert "argA" in res
379379

380380
@pytest.mark.asyncio
381-
async def test_bind_param_fail(self, tool_name, client):
382-
"""Tests 'bind_param' with a bound parameter that doesn't exist."""
381+
async def test_bind_param_fail_on_rebind(self, tool_name, client):
382+
"""
383+
Tests that 'bind_parameters' fails when attempting to re-bind a
384+
parameter that has already been bound.
385+
"""
383386
tool = await client.load_tool(tool_name)
384387

385388
assert len(tool.__signature__.parameters) == 2
386389
assert "argA" in tool.__signature__.parameters
387390

388-
with pytest.raises(Exception):
389-
tool = tool.bind_parameters({"argC": lambda: 5})
391+
bound_tool_once = tool.bind_parameters({"argA": 5})
392+
assert "argA" not in bound_tool_once.__signature__.parameters
393+
assert "argB" in bound_tool_once.__signature__.parameters
394+
395+
expected_error_msg = "cannot re-bind parameter: parameter 'argA' is already bound"
396+
with pytest.raises(ValueError, match=expected_error_msg):
397+
bound_tool_once.bind_parameters({"argA": 10})
390398

391399
@pytest.mark.asyncio
392400
async def test_bind_param_static_value_success(self, tool_name, client):

0 commit comments

Comments
 (0)