Skip to content

Commit 29da603

Browse files
committed
chore: Improve e2e tests
1 parent 4decbad commit 29da603

File tree

1 file changed

+39
-14
lines changed

1 file changed

+39
-14
lines changed

packages/toolbox-core/tests/test_e2e.py

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,42 +239,67 @@ async def test_tool_signature_is_correct(self, toolbox: ToolboxClient):
239239
assert "limit" in sig.parameters
240240

241241
# 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
244244

245245
# 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]
248252

249253
async def test_run_tool_with_optional_param_omitted(self, toolbox: ToolboxClient):
250254
"""Invoke a tool providing only the required parameter."""
251255
tool = await toolbox.load_tool("search-rows")
252256

253-
response = await tool(email="[email protected]")
257+
response = await tool(
258+
259+
)
254260
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
257268

258269
async def test_run_tool_with_optional_data_provided(self, toolbox: ToolboxClient):
259270
"""Invoke a tool providing both required and optional parameters."""
260271
tool = await toolbox.load_tool("search-rows")
261272

262-
response = await tool(email="[email protected]", data="row2")
273+
response = await tool(
274+
email="[email protected]", data="row3"
275+
)
263276
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
266284

267285
async def test_run_tool_with_optional_id_provided(self, toolbox: ToolboxClient):
268286
"""Invoke a tool providing both required and optional parameters."""
269287
tool = await toolbox.load_tool("search-rows")
270288

271-
response = await tool(email="[email protected]", id=1)
289+
response = await tool(
290+
email="[email protected]", id=1
291+
)
272292
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
275300

276301
async def test_run_tool_with_missing_required_param(self, toolbox: ToolboxClient):
277302
"""Invoke a tool without its required parameter."""
278303
tool = await toolbox.load_tool("search-rows")
279304
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

Comments
 (0)