@@ -66,6 +66,7 @@ def test_tool_auth():
6666 ],
6767 )
6868
69+
6970@pytest .fixture
7071def tool_schema_minimal ():
7172 """A tool with no parameters, no auth."""
@@ -74,14 +75,15 @@ def tool_schema_minimal():
7475 parameters = [],
7576 )
7677
78+
7779@pytest .fixture
7880def tool_schema_requires_auth_X ():
7981 """A tool requiring 'auth_service_X'."""
8082 return ToolSchema (
8183 description = "Tool Requiring Auth X" ,
8284 parameters = [
8385 ParameterSchema (
84- name = "auth_param_X" , #
86+ name = "auth_param_X" , #
8587 type = "string" ,
8688 description = "Auth X Token" ,
8789 authSources = ["auth_service_X" ],
@@ -101,6 +103,7 @@ def tool_schema_with_param_P():
101103 ],
102104 )
103105
106+
104107# --- Helper Functions for Mocking ---
105108
106109
@@ -580,7 +583,9 @@ async def test_load_tool_with_unused_auth_token_raises_error(
580583 The tool (tool_schema_minimal) does not declare any authSources.
581584 """
582585 tool_name = "minimal_tool_for_unused_auth"
583- mock_tool_load (aioresponses , tool_name , tool_schema_minimal , base_url = TEST_BASE_URL )
586+ mock_tool_load (
587+ aioresponses , tool_name , tool_schema_minimal , base_url = TEST_BASE_URL
588+ )
584589
585590 async with ToolboxClient (TEST_BASE_URL ) as client :
586591 with pytest .raises (
@@ -601,7 +606,9 @@ async def test_load_tool_with_unused_bound_parameter_raises_error(
601606 provided. The tool (tool_schema_minimal) has no parameters to bind.
602607 """
603608 tool_name = "minimal_tool_for_unused_bound"
604- mock_tool_load (aioresponses , tool_name , tool_schema_minimal , base_url = TEST_BASE_URL )
609+ mock_tool_load (
610+ aioresponses , tool_name , tool_schema_minimal , base_url = TEST_BASE_URL
611+ )
605612
606613 async with ToolboxClient (TEST_BASE_URL ) as client :
607614 with pytest .raises (
@@ -621,7 +628,9 @@ async def test_load_tool_with_unused_auth_and_bound_raises_error(
621628 are provided.
622629 """
623630 tool_name = "minimal_tool_for_unused_both"
624- mock_tool_load (aioresponses , tool_name , tool_schema_minimal , base_url = TEST_BASE_URL )
631+ mock_tool_load (
632+ aioresponses , tool_name , tool_schema_minimal , base_url = TEST_BASE_URL
633+ )
625634
626635 async with ToolboxClient (TEST_BASE_URL ) as client :
627636 with pytest .raises (
@@ -647,7 +656,9 @@ async def test_load_toolset_strict_one_tool_unused_auth_raises(
647656 toolset_name = "strict_set_single_tool_unused_auth"
648657 tool_A_name = "tool_A_minimal"
649658 tools_dict = {tool_A_name : tool_schema_minimal }
650- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
659+ mock_toolset_load (
660+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
661+ )
651662
652663 async with ToolboxClient (TEST_BASE_URL ) as client :
653664 with pytest .raises (
@@ -677,7 +688,9 @@ async def test_load_toolset_strict_first_tool_fails_auth_raises(
677688 tool_minimal_name : tool_schema_minimal ,
678689 tool_auth_X_name : tool_schema_requires_auth_X ,
679690 }
680- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
691+ mock_toolset_load (
692+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
693+ )
681694
682695 async with ToolboxClient (TEST_BASE_URL ) as client :
683696 with pytest .raises (
@@ -708,7 +721,9 @@ async def test_load_toolset_strict_second_tool_fails_auth_raises(
708721 tool_auth_X_name : tool_schema_requires_auth_X ,
709722 tool_minimal_name : tool_schema_minimal ,
710723 }
711- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
724+ mock_toolset_load (
725+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
726+ )
712727
713728 async with ToolboxClient (TEST_BASE_URL ) as client :
714729 with pytest .raises (
@@ -722,6 +737,7 @@ async def test_load_toolset_strict_second_tool_fails_auth_raises(
722737 },
723738 strict = True ,
724739 )
740+
725741 @pytest .mark .asyncio
726742 async def test_load_toolset_strict_one_tool_unused_bound_raises (
727743 self , aioresponses , tool_schema_minimal
@@ -733,7 +749,9 @@ async def test_load_toolset_strict_one_tool_unused_bound_raises(
733749 toolset_name = "strict_set_single_tool_unused_bound"
734750 tool_A_name = "tool_A_minimal_for_bound"
735751 tools_dict = {tool_A_name : tool_schema_minimal }
736- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
752+ mock_toolset_load (
753+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
754+ )
737755
738756 async with ToolboxClient (TEST_BASE_URL ) as client :
739757 with pytest .raises (
@@ -762,7 +780,9 @@ async def test_load_toolset_strict_first_tool_fails_bound_raises(
762780 tool_minimal_name : tool_schema_minimal ,
763781 tool_param_P_name : tool_schema_with_param_P ,
764782 }
765- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
783+ mock_toolset_load (
784+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
785+ )
766786
767787 async with ToolboxClient (TEST_BASE_URL ) as client :
768788 with pytest .raises (
@@ -793,7 +813,9 @@ async def test_load_toolset_strict_second_tool_fails_bound_raises(
793813 tool_param_P_name : tool_schema_with_param_P ,
794814 tool_minimal_name : tool_schema_minimal ,
795815 }
796- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
816+ mock_toolset_load (
817+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
818+ )
797819
798820 async with ToolboxClient (TEST_BASE_URL ) as client :
799821 with pytest .raises (
@@ -808,8 +830,6 @@ async def test_load_toolset_strict_second_tool_fails_bound_raises(
808830 strict = True ,
809831 )
810832
811-
812-
813833 @pytest .mark .asyncio
814834 async def test_load_toolset_strict_with_unused_auth_and_bound_raises_error (
815835 self , aioresponses , tool_schema_minimal
@@ -822,7 +842,9 @@ async def test_load_toolset_strict_with_unused_auth_and_bound_raises_error(
822842 toolset_name = "strict_set_unused_both_minimal_tool"
823843 tool_minimal_name = "minimal_for_both_strict"
824844 tools_dict = {tool_minimal_name : tool_schema_minimal }
825- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
845+ mock_toolset_load (
846+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
847+ )
826848
827849 async with ToolboxClient (TEST_BASE_URL ) as client :
828850 with pytest .raises (
@@ -851,7 +873,9 @@ async def test_load_toolset_non_strict_globally_unused_auth_raises_error(
851873 "auth_tool" : tool_schema_requires_auth_X ,
852874 "minimal_tool_in_set" : tool_schema_minimal ,
853875 }
854- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
876+ mock_toolset_load (
877+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
878+ )
855879
856880 async with ToolboxClient (TEST_BASE_URL ) as client :
857881 with pytest .raises (
@@ -880,7 +904,9 @@ async def test_load_toolset_non_strict_globally_unused_bound_raises_error(
880904 "param_P_tool_in_set" : tool_schema_with_param_P ,
881905 "minimal_tool_in_set_bound" : tool_schema_minimal ,
882906 }
883- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
907+ mock_toolset_load (
908+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
909+ )
884910
885911 async with ToolboxClient (TEST_BASE_URL ) as client :
886912 with pytest .raises (
@@ -909,7 +935,9 @@ async def test_load_toolset_non_strict_globally_unused_auth_and_bound_raises_err
909935 "auth_tool_for_both" : tool_schema_requires_auth_X ,
910936 "param_P_tool_for_both" : tool_schema_with_param_P ,
911937 }
912- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
938+ mock_toolset_load (
939+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
940+ )
913941
914942 async with ToolboxClient (TEST_BASE_URL ) as client :
915943 with pytest .raises (
@@ -928,7 +956,7 @@ async def test_load_toolset_non_strict_globally_unused_auth_and_bound_raises_err
928956 },
929957 strict = False ,
930958 )
931-
959+
932960 @pytest .mark .asyncio
933961 async def test_load_toolset_non_strict_default_name_globally_unused_auth (
934962 self , aioresponses , tool_schema_minimal
@@ -940,7 +968,9 @@ async def test_load_toolset_non_strict_default_name_globally_unused_auth(
940968 toolset_name = None
941969 expected_error_toolset_name = "default"
942970 tools_dict = {"some_minimal_tool" : tool_schema_minimal }
943- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
971+ mock_toolset_load (
972+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
973+ )
944974
945975 async with ToolboxClient (TEST_BASE_URL ) as client :
946976 with pytest .raises (
@@ -949,11 +979,12 @@ async def test_load_toolset_non_strict_default_name_globally_unused_auth(
949979 ):
950980 await client .load_toolset (
951981 name = toolset_name ,
952- auth_token_getters = {"globally_unused_auth_default" : lambda : "token" },
982+ auth_token_getters = {
983+ "globally_unused_auth_default" : lambda : "token"
984+ },
953985 strict = False ,
954986 )
955987
956-
957988 @pytest .mark .asyncio
958989 async def test_load_toolset_non_strict_partially_used_auth_succeeds (
959990 self , aioresponses , tool_schema_minimal , tool_schema_requires_auth_X
@@ -967,7 +998,9 @@ async def test_load_toolset_non_strict_partially_used_auth_succeeds(
967998 "auth_tool_partial" : tool_schema_requires_auth_X ,
968999 "minimal_tool_partial" : tool_schema_minimal ,
9691000 }
970- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
1001+ mock_toolset_load (
1002+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
1003+ )
9711004
9721005 async with ToolboxClient (TEST_BASE_URL ) as client :
9731006 await client .load_toolset (
@@ -976,7 +1009,6 @@ async def test_load_toolset_non_strict_partially_used_auth_succeeds(
9761009 strict = False ,
9771010 )
9781011
979-
9801012 @pytest .mark .asyncio
9811013 async def test_load_toolset_non_strict_partially_used_bound_succeeds (
9821014 self , aioresponses , tool_schema_minimal , tool_schema_with_param_P
@@ -990,7 +1022,9 @@ async def test_load_toolset_non_strict_partially_used_bound_succeeds(
9901022 "param_P_tool_partial" : tool_schema_with_param_P ,
9911023 "minimal_tool_partial_bound" : tool_schema_minimal ,
9921024 }
993- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
1025+ mock_toolset_load (
1026+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
1027+ )
9941028
9951029 async with ToolboxClient (TEST_BASE_URL ) as client :
9961030 await client .load_toolset (
@@ -999,7 +1033,6 @@ async def test_load_toolset_non_strict_partially_used_bound_succeeds(
9991033 strict = False ,
10001034 )
10011035
1002-
10031036 @pytest .mark .asyncio
10041037 async def test_load_toolset_non_strict_partially_used_auth_and_bound_succeeds (
10051038 self , aioresponses , tool_schema_requires_auth_X , tool_schema_with_param_P
@@ -1013,7 +1046,9 @@ async def test_load_toolset_non_strict_partially_used_auth_and_bound_succeeds(
10131046 "auth_tool_for_both" : tool_schema_requires_auth_X ,
10141047 "param_P_tool_for_both" : tool_schema_with_param_P ,
10151048 }
1016- mock_toolset_load (aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL )
1049+ mock_toolset_load (
1050+ aioresponses , toolset_name , tools_dict , base_url = TEST_BASE_URL
1051+ )
10171052
10181053 async with ToolboxClient (TEST_BASE_URL ) as client :
10191054 await client .load_toolset (
0 commit comments