Skip to content

Commit a0b36dd

Browse files
committed
updated tests to use snapshot
1 parent 6547863 commit a0b36dd

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/test_tools.py

+16-5
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,14 @@ def y_tool(y: str) -> None:
358358
agent = Agent('test', tools=[Tool(x_tool, function_schema=y_fs)])
359359

360360
# make sure the function schema for y_tool is used instead of the default of x_tool.
361-
assert 'x' not in agent._function_tools['x_tool']._parameters_json_schema['properties']
362-
assert 'y' in agent._function_tools['x_tool']._parameters_json_schema['properties']
361+
assert agent._function_tools['x_tool']._parameters_json_schema == snapshot(
362+
{
363+
'additionalProperties': False,
364+
'properties': {'y': {'title': 'Y', 'type': 'string'}},
365+
'required': ['y'],
366+
'type': 'object',
367+
}
368+
)
363369

364370

365371
def test_init_tool_ctx_with_function_schema():
@@ -374,9 +380,14 @@ def y_tool(ctx: RunContext[int], y: str) -> None:
374380
)
375381
agent = Agent('test', tools=[Tool(x_tool, function_schema=y_fs, takes_ctx=True)], deps_type=int)
376382

377-
# make sure the function schema for y_tool is used instead of the default of x_tool.
378-
assert 'x' not in agent._function_tools['x_tool']._parameters_json_schema['properties']
379-
assert 'y' in agent._function_tools['x_tool']._parameters_json_schema['properties']
383+
assert agent._function_tools['x_tool']._parameters_json_schema == snapshot(
384+
{
385+
'additionalProperties': False,
386+
'properties': {'y': {'title': 'Y', 'type': 'string'}},
387+
'required': ['y'],
388+
'type': 'object',
389+
}
390+
)
380391

381392

382393
def ctx_tool(ctx: RunContext[int], x: int) -> int:

0 commit comments

Comments
 (0)