Skip to content

Commit d62d274

Browse files
committed
chore: Update unit test case
1 parent 6a36b49 commit d62d274

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
@@ -430,15 +430,23 @@ async def test_bind_callable_param_success(self, tool_name, client):
430430
assert "argA" in res
431431

432432
@pytest.mark.asyncio
433-
async def test_bind_param_fail(self, tool_name, client):
434-
"""Tests 'bind_param' with a bound parameter that doesn't exist."""
433+
async def test_bind_param_fail_on_rebind(self, tool_name, client):
434+
"""
435+
Tests that 'bind_parameters' fails when attempting to re-bind a
436+
parameter that has already been bound.
437+
"""
435438
tool = await client.load_tool(tool_name)
436439

437440
assert len(tool.__signature__.parameters) == 2
438441
assert "argA" in tool.__signature__.parameters
439442

440-
with pytest.raises(Exception):
441-
tool = tool.bind_parameters({"argC": lambda: 5})
443+
bound_tool_once = tool.bind_parameters({"argA": 5})
444+
assert "argA" not in bound_tool_once.__signature__.parameters
445+
assert "argB" in bound_tool_once.__signature__.parameters
446+
447+
expected_error_msg = "cannot re-bind parameter: parameter 'argA' is already bound"
448+
with pytest.raises(ValueError, match=expected_error_msg):
449+
bound_tool_once.bind_parameters({"argA": 10})
442450

443451
@pytest.mark.asyncio
444452
async def test_bind_param_static_value_success(self, tool_name, client):

0 commit comments

Comments
 (0)