Skip to content

Commit aee6675

Browse files
ericapisaniclaude
andcommitted
test(pydantic-ai): Update test to verify tool description is omitted when None
The execute_tool_span function now skips setting GEN_AI_TOOL_DESCRIPTION when tool_definition.description is None, instead of setting it to None. Update the corresponding test to verify the key is absent from span data rather than present with a None value, and rename the test to reflect this behavior. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 7a7f2bc commit aee6675

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/integrations/pydantic_ai/test_pydantic_ai.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,11 +2837,11 @@ def multiply_numbers(a: int, b: int) -> int:
28372837

28382838

28392839
@pytest.mark.asyncio
2840-
async def test_tool_without_description_sets_tool_description_to_none(
2840+
async def test_tool_without_description_omits_tool_description(
28412841
sentry_init, capture_events
28422842
):
28432843
"""
2844-
Test that execute_tool spans set tool description to None when the tool has no docstring.
2844+
Test that execute_tool spans omit tool description when the tool has no docstring.
28452845
"""
28462846
agent = Agent(
28472847
"test",
@@ -2872,5 +2872,4 @@ def no_docs_tool(a: int, b: int) -> int:
28722872

28732873
tool_span = tool_spans[0]
28742874
assert tool_span["data"]["gen_ai.tool.name"] == "no_docs_tool"
2875-
assert SPANDATA.GEN_AI_TOOL_DESCRIPTION in tool_span["data"]
2876-
assert tool_span["data"][SPANDATA.GEN_AI_TOOL_DESCRIPTION] is None
2875+
assert SPANDATA.GEN_AI_TOOL_DESCRIPTION not in tool_span["data"]

0 commit comments

Comments
 (0)