@@ -239,42 +239,67 @@ async def test_tool_signature_is_correct(self, toolbox: ToolboxClient):
239
239
assert "limit" in sig .parameters
240
240
241
241
# The required parameter should have no default
242
- assert sig .parameters ["query " ].default is Parameter .empty
243
- assert sig .parameters ["query " ].annotation is str
242
+ assert sig .parameters ["email " ].default is Parameter .empty
243
+ assert sig .parameters ["email " ].annotation is str
244
244
245
245
# The optional parameter should have a default of None
246
- assert sig .parameters ["limit" ].default is None
247
- assert sig .parameters ["limit" ].annotation is Optional [int ]
246
+ assert sig .parameters ["data" ].default is "row2"
247
+ assert sig .parameters ["limit" ].annotation is Optional [str ]
248
+
249
+ # The optional parameter should have a default of None
250
+ assert sig .parameters ["id" ].default is None
251
+ assert sig .parameters ["id" ].annotation is Optional [int ]
248
252
249
253
async def test_run_tool_with_optional_param_omitted (self , toolbox : ToolboxClient ):
250
254
"""Invoke a tool providing only the required parameter."""
251
255
tool = await toolbox .load_tool ("search-rows" )
252
256
253
- response = await tool (
email = "[email protected] " )
257
+ response = await tool (
258
+
259
+ )
254
260
assert isinstance (response , str )
255
- assert 'query="test query"' in response
256
- assert "limit" not in response
261
+ assert 'email="[email protected] "' in response
262
+ assert "row1" not in response
263
+ assert "row2" in response
264
+ assert "row3" not in response
265
+ assert "row4" not in response
266
+ assert "row5" not in response
267
+ assert "row6" not in response
257
268
258
269
async def test_run_tool_with_optional_data_provided (self , toolbox : ToolboxClient ):
259
270
"""Invoke a tool providing both required and optional parameters."""
260
271
tool = await toolbox .load_tool ("search-rows" )
261
272
262
- response = await tool (
email = "[email protected] " ,
data = "row2" )
273
+ response = await tool (
274
+ email = "[email protected] " ,
data = "row3"
275
+ )
263
276
assert isinstance (response , str )
264
- assert 'query="test query"' in response
265
- assert "limit=10" in response
277
+ assert 'email="[email protected] "' in response
278
+ assert "row1" not in response
279
+ assert "row2" not in response
280
+ assert "row3" in response
281
+ assert "row4" not in response
282
+ assert "row5" not in response
283
+ assert "row6" not in response
266
284
267
285
async def test_run_tool_with_optional_id_provided (self , toolbox : ToolboxClient ):
268
286
"""Invoke a tool providing both required and optional parameters."""
269
287
tool = await toolbox .load_tool ("search-rows" )
270
288
271
- response = await tool (
email = "[email protected] " ,
id = 1 )
289
+ response = await tool (
290
+
291
+ )
272
292
assert isinstance (response , str )
273
- assert 'query="test query"' in response
274
- assert "limit=10" in response
293
+ assert 'email="[email protected] "' in response
294
+ assert "row1" in response
295
+ assert "row2" not in response
296
+ assert "row3" not in response
297
+ assert "row4" not in response
298
+ assert "row5" not in response
299
+ assert "row6" not in response
275
300
276
301
async def test_run_tool_with_missing_required_param (self , toolbox : ToolboxClient ):
277
302
"""Invoke a tool without its required parameter."""
278
303
tool = await toolbox .load_tool ("search-rows" )
279
304
with pytest .raises (TypeError , match = "missing a required argument: 'email'" ):
280
- await tool (id = 2 , data = "row2 " )
305
+ await tool (id = 5 , data = "row5 " )
0 commit comments