@@ -250,7 +250,7 @@ async def test_tool_signature_is_correct(self, toolbox: ToolboxClient):
250
250
assert sig .parameters ["id" ].default is None
251
251
assert sig .parameters ["id" ].annotation is Optional [int ]
252
252
253
- async def test_run_tool_with_optional_param_omitted (self , toolbox : ToolboxClient ):
253
+ async def test_run_tool_with_optional_params_omitted (self , toolbox : ToolboxClient ):
254
254
"""Invoke a tool providing only the required parameter."""
255
255
tool = await toolbox .load_tool ("search-rows" )
256
256
@@ -278,6 +278,21 @@ async def test_run_tool_with_optional_data_provided(self, toolbox: ToolboxClient
278
278
assert "row5" not in response
279
279
assert "row6" not in response
280
280
281
+ async def test_run_tool_with_optional_data_null (self , toolbox : ToolboxClient ):
282
+ """Invoke a tool providing both required and optional parameters."""
283
+ tool = await toolbox .load_tool ("search-rows" )
284
+
285
+ response = await tool (
email = "[email protected] " ,
data = None )
286
+ assert isinstance (response , str )
287
+ assert 'email="[email protected] "' in response
288
+ assert "row1" not in response
289
+ assert "row2" in response
290
+ assert "row3" not in response
291
+ assert "row4" not in response
292
+ assert "row5" not in response
293
+ assert "row6" not in response
294
+
295
+
281
296
async def test_run_tool_with_optional_id_provided (self , toolbox : ToolboxClient ):
282
297
"""Invoke a tool providing both required and optional parameters."""
283
298
tool = await toolbox .load_tool ("search-rows" )
@@ -292,8 +307,28 @@ async def test_run_tool_with_optional_id_provided(self, toolbox: ToolboxClient):
292
307
assert "row5" not in response
293
308
assert "row6" not in response
294
309
310
+ async def test_run_tool_with_optional_id_null (self , toolbox : ToolboxClient ):
311
+ """Invoke a tool providing both required and optional parameters."""
312
+ tool = await toolbox .load_tool ("search-rows" )
313
+
314
+ response = await tool (
email = "[email protected] " ,
id = None )
315
+ assert isinstance (response , str )
316
+ assert 'email="[email protected] "' in response
317
+ assert "row1" not in response
318
+ assert "row2" in response
319
+ assert "row3" not in response
320
+ assert "row4" not in response
321
+ assert "row5" not in response
322
+ assert "row6" not in response
323
+
295
324
async def test_run_tool_with_missing_required_param (self , toolbox : ToolboxClient ):
296
325
"""Invoke a tool without its required parameter."""
297
326
tool = await toolbox .load_tool ("search-rows" )
298
327
with pytest .raises (TypeError , match = "missing a required argument: 'email'" ):
299
328
await tool (id = 5 , data = "row5" )
329
+
330
+ async def test_run_tool_with_required_param_null (self , toolbox : ToolboxClient ):
331
+ """Invoke a tool without its required parameter."""
332
+ tool = await toolbox .load_tool ("search-rows" )
333
+ with pytest .raises (TypeError , match = "missing a required argument: 'email'" ):
334
+ await tool (email = None , id = 5 , data = "row5" )
0 commit comments