@@ -599,137 +599,6 @@ async def test_bind_callable_param_success(self, tool_name, client):
599
599
res = await tool (True )
600
600
assert "argA" in res
601
601
602
- @pytest .mark .asyncio
603
- async def test_bind_param_fail (self , tool_name , client ):
604
- """Tests 'bind_param' with a bound parameter that doesn't exist."""
605
- tool = await client .load_tool (tool_name )
606
-
607
- assert len (tool .__signature__ .parameters ) == 2
608
- assert "argA" in tool .__signature__ .parameters
609
-
610
- with pytest .raises (ValueError ) as e :
611
- tool .bind_param ("argC" , lambda : 5 )
612
- assert "unable to bind parameters: no parameter named argC" in str (e .value )
613
-
614
- @pytest .mark .asyncio
615
- async def test_rebind_param_fail (self , tool_name , client ):
616
- """
617
- Tests that 'bind_param' fails when attempting to re-bind a
618
- parameter that has already been bound.
619
- """
620
- tool = await client .load_tool (tool_name )
621
-
622
- assert len (tool .__signature__ .parameters ) == 2
623
- assert "argA" in tool .__signature__ .parameters
624
-
625
- tool_with_bound_param = tool .bind_param ("argA" , lambda : 10 )
626
-
627
- assert len (tool_with_bound_param .__signature__ .parameters ) == 1
628
- assert "argA" not in tool_with_bound_param .__signature__ .parameters
629
-
630
- with pytest .raises (ValueError ) as e :
631
- tool_with_bound_param .bind_param ("argA" , lambda : 20 )
632
-
633
- assert "cannot re-bind parameter: parameter 'argA' is already bound" in str (
634
- e .value
635
- )
636
-
637
- @pytest .mark .asyncio
638
- async def test_bind_param_static_value_success (self , tool_name , client ):
639
- """
640
- Tests bind_param method with a static value.
641
- """
642
-
643
- bound_value = "Test value"
644
-
645
- tool = await client .load_tool (tool_name )
646
- bound_tool = tool .bind_param ("argB" , bound_value )
647
-
648
- assert bound_tool is not tool
649
- assert "argB" not in bound_tool .__signature__ .parameters
650
- assert "argA" in bound_tool .__signature__ .parameters
651
-
652
- passed_value_a = 42
653
- res_payload = await bound_tool (argA = passed_value_a )
654
-
655
- assert res_payload == {"argA" : passed_value_a , "argB" : bound_value }
656
-
657
- @pytest .mark .asyncio
658
- async def test_bind_param_sync_callable_value_success (self , tool_name , client ):
659
- """
660
- Tests bind_param method with a sync callable value.
661
- """
662
-
663
- bound_value_result = True
664
- bound_sync_callable = Mock (return_value = bound_value_result )
665
-
666
- tool = await client .load_tool (tool_name )
667
- bound_tool = tool .bind_param ("argB" , bound_sync_callable )
668
-
669
- assert bound_tool is not tool
670
- assert "argB" not in bound_tool .__signature__ .parameters
671
- assert "argA" in bound_tool .__signature__ .parameters
672
-
673
- passed_value_a = 42
674
- res_payload = await bound_tool (argA = passed_value_a )
675
-
676
- assert res_payload == {"argA" : passed_value_a , "argB" : bound_value_result }
677
- bound_sync_callable .assert_called_once ()
678
-
679
- @pytest .mark .asyncio
680
- async def test_bind_param_async_callable_value_success (self , tool_name , client ):
681
- """
682
- Tests bind_param method with an async callable value.
683
- """
684
-
685
- bound_value_result = True
686
- bound_async_callable = AsyncMock (return_value = bound_value_result )
687
-
688
- tool = await client .load_tool (tool_name )
689
- bound_tool = tool .bind_param ("argB" , bound_async_callable )
690
-
691
- assert bound_tool is not tool
692
- assert "argB" not in bound_tool .__signature__ .parameters
693
- assert "argA" in bound_tool .__signature__ .parameters
694
-
695
- passed_value_a = 42
696
- res_payload = await bound_tool (argA = passed_value_a )
697
-
698
- assert res_payload == {"argA" : passed_value_a , "argB" : bound_value_result }
699
- bound_async_callable .assert_awaited_once ()
700
-
701
- @pytest .mark .asyncio
702
- async def test_bind_param_success (self , tool_name , client ):
703
- """Tests 'bind_param' with a bound parameter specified."""
704
- tool = await client .load_tool (tool_name )
705
-
706
- assert len (tool .__signature__ .parameters ) == 2
707
- assert "argA" in tool .__signature__ .parameters
708
-
709
- tool = tool .bind_param ("argA" , 5 )
710
-
711
- assert len (tool .__signature__ .parameters ) == 1
712
- assert "argA" not in tool .__signature__ .parameters
713
-
714
- res = await tool (True )
715
- assert "argA" in res
716
-
717
- @pytest .mark .asyncio
718
- async def test_bind_callable_param_success (self , tool_name , client ):
719
- """Tests 'bind_param' with a bound parameter specified."""
720
- tool = await client .load_tool (tool_name )
721
-
722
- assert len (tool .__signature__ .parameters ) == 2
723
- assert "argA" in tool .__signature__ .parameters
724
-
725
- tool = tool .bind_param ("argA" , lambda : 5 )
726
-
727
- assert len (tool .__signature__ .parameters ) == 1
728
- assert "argA" not in tool .__signature__ .parameters
729
-
730
- res = await tool (True )
731
- assert "argA" in res
732
-
733
602
@pytest .mark .asyncio
734
603
async def test_bind_param_fail (self , tool_name , client ):
735
604
"""Tests 'bind_param' with a bound parameter that doesn't exist."""
0 commit comments