@@ -38,7 +38,9 @@ def tool_params(self) -> list[Parameter]:
38
38
default = 123 ,
39
39
annotation = Optional [int ],
40
40
),
41
- Parameter ("req_kwarg" , Parameter .KEYWORD_ONLY , annotation = bool ), # Added back
41
+ Parameter (
42
+ "req_kwarg" , Parameter .KEYWORD_ONLY , annotation = bool
43
+ ), # Added back
42
44
]
43
45
44
46
@pytest .fixture
@@ -144,7 +146,10 @@ def bound_arg1_value(self) -> str:
144
146
145
147
@pytest .fixture
146
148
def tool_with_bound_arg1 (
147
- self , mock_session : MagicMock , tool_details : dict [str , Any ], bound_arg1_value : str
149
+ self ,
150
+ mock_session : MagicMock ,
151
+ tool_details : dict [str , Any ],
152
+ bound_arg1_value : str ,
148
153
) -> ToolboxTool :
149
154
bound_params = {"arg1" : bound_arg1_value }
150
155
return ToolboxTool (
@@ -155,14 +160,15 @@ def tool_with_bound_arg1(
155
160
params = tool_details ["params" ], # Use corrected params
156
161
bound_params = bound_params ,
157
162
)
163
+
158
164
@pytest .mark .asyncio
159
165
async def test_bound_parameter_static_value_call (
160
- self ,
161
- tool_with_bound_arg1 : ToolboxTool ,
162
- mock_session : MagicMock ,
163
- tool_details : dict [str , Any ],
164
- configure_mock_response : Callable ,
165
- bound_arg1_value : str ,
166
+ self ,
167
+ tool_with_bound_arg1 : ToolboxTool ,
168
+ mock_session : MagicMock ,
169
+ tool_details : dict [str , Any ],
170
+ configure_mock_response : Callable ,
171
+ bound_arg1_value : str ,
166
172
):
167
173
"""Test calling a tool with a statically bound parameter."""
168
174
expected_result = "Bound call success!"
@@ -172,12 +178,18 @@ async def test_bound_parameter_static_value_call(
172
178
req_kwarg_val = True # The only remaining required arg
173
179
174
180
# Call *without* providing arg1, but provide the others
175
- result = await tool_with_bound_arg1 (opt_arg = opt_arg_val , req_kwarg = req_kwarg_val )
181
+ result = await tool_with_bound_arg1 (
182
+ opt_arg = opt_arg_val , req_kwarg = req_kwarg_val
183
+ )
176
184
177
185
assert result == expected_result
178
186
mock_session .post .assert_called_once_with (
179
187
tool_details ["expected_url" ],
180
188
# Payload should include the bound value for arg1
181
- json = {"arg1" : bound_arg1_value , "opt_arg" : opt_arg_val , "req_kwarg" : req_kwarg_val },
189
+ json = {
190
+ "arg1" : bound_arg1_value ,
191
+ "opt_arg" : opt_arg_val ,
192
+ "req_kwarg" : req_kwarg_val ,
193
+ },
182
194
)
183
195
mock_session .post .return_value .__aenter__ .return_value .json .assert_awaited_once ()
0 commit comments