@@ -430,7 +430,19 @@ async def test_bind_callable_param_success(self, tool_name, client):
430
430
assert "argA" in res
431
431
432
432
@pytest .mark .asyncio
433
- async def test_bind_param_fail_on_rebind (self , tool_name , client ):
433
+ async def test_bind_param_fail (self , tool_name , client ):
434
+ """Tests 'bind_parameters' with a bound parameter that doesn't exist."""
435
+ tool = await client .load_tool (tool_name )
436
+
437
+ assert len (tool .__signature__ .parameters ) == 2
438
+ assert "argA" in tool .__signature__ .parameters
439
+
440
+ with pytest .raises (Exception ) as e :
441
+ tool .bind_parameters ({"argC" : lambda : 5 })
442
+ assert "unable to bind parameters: no parameter named argC" in str (e .value )
443
+
444
+ @pytest .mark .asyncio
445
+ async def test_rebind_param_fail (self , tool_name , client ):
434
446
"""
435
447
Tests that 'bind_parameters' fails when attempting to re-bind a
436
448
parameter that has already been bound.
@@ -440,15 +452,12 @@ async def test_bind_param_fail_on_rebind(self, tool_name, client):
440
452
assert len (tool .__signature__ .parameters ) == 2
441
453
assert "argA" in tool .__signature__ .parameters
442
454
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
455
+ tool_with_bound_param = tool .bind_parameters ({"argA" : lambda : 10 })
446
456
447
- expected_error_msg = (
448
- "cannot re-bind parameter: parameter 'argA' is already bound"
449
- )
450
- with pytest .raises (ValueError , match = expected_error_msg ):
451
- bound_tool_once .bind_parameters ({"argA" : 10 })
457
+ with pytest .raises (ValueError ) as e :
458
+ tool_with_bound_param .bind_parameters ({"argA" : lambda : 20 })
459
+
460
+ assert "cannot re-bind parameter: parameter 'argA' is already bound" in str (e .value )
452
461
453
462
@pytest .mark .asyncio
454
463
async def test_bind_param_static_value_success (self , tool_name , client ):
0 commit comments