Skip to content

Commit feee6b2

Browse files
committed
Clean up tests
1 parent b92da23 commit feee6b2

File tree

2 files changed

+3
-60
lines changed

2 files changed

+3
-60
lines changed

pydantic_ai_slim/pydantic_ai/_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def build_json_schema(
434434
for key in object_keys:
435435
count = 1
436436
new_key = key
437-
while new_key in unique_object_keys: # pragma: no cover
437+
while new_key in unique_object_keys:
438438
count += 1
439439
new_key = f'{key}_{count}'
440440
unique_object_keys.append(new_key)

tests/test_agent_output_schemas.py

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def test_tool_output_json_schema():
4646

4747
agent = Agent(
4848
'test',
49-
output_type=[ToolOutput(bool, name='alice', description='Dreaming'), ToolOutput(bool, name='bob')],
49+
output_type=[ToolOutput(bool, name='alice'), ToolOutput(bool, name='bob')],
5050
)
5151
assert agent.output_json_schema() == snapshot(
5252
{
@@ -88,63 +88,6 @@ async def test_tool_output_json_schema():
8888
}
8989
)
9090

91-
agent = Agent(
92-
'test',
93-
output_type=[ToolOutput(bool, name='alice')] * 3,
94-
)
95-
assert agent.output_json_schema() == snapshot(
96-
{
97-
'type': 'object',
98-
'properties': {
99-
'result': {
100-
'anyOf': [
101-
{
102-
'type': 'object',
103-
'properties': {
104-
'kind': {'type': 'string', 'const': 'alice'},
105-
'data': {
106-
'properties': {'response': {'type': 'boolean'}},
107-
'required': ['response'],
108-
'type': 'object',
109-
},
110-
},
111-
'required': ['kind', 'data'],
112-
'additionalProperties': False,
113-
},
114-
{
115-
'type': 'object',
116-
'properties': {
117-
'kind': {'type': 'string', 'const': 'alice_2'},
118-
'data': {
119-
'properties': {'response': {'type': 'boolean'}},
120-
'required': ['response'],
121-
'type': 'object',
122-
},
123-
},
124-
'required': ['kind', 'data'],
125-
'additionalProperties': False,
126-
},
127-
{
128-
'type': 'object',
129-
'properties': {
130-
'kind': {'type': 'string', 'const': 'alice_3'},
131-
'data': {
132-
'properties': {'response': {'type': 'boolean'}},
133-
'required': ['response'],
134-
'type': 'object',
135-
},
136-
},
137-
'required': ['kind', 'data'],
138-
'additionalProperties': False,
139-
},
140-
]
141-
}
142-
},
143-
'required': ['result'],
144-
'additionalProperties': False,
145-
}
146-
)
147-
14891

14992
async def test_native_output_json_schema():
15093
agent = Agent(
@@ -372,7 +315,7 @@ async def test_image_output_json_schema():
372315
async def test_override_output_json_schema():
373316
agent = Agent('test')
374317
assert agent.output_json_schema() == snapshot({'type': 'string'})
375-
output_type = [ToolOutput(bool, name='alice', description='Dreaming...')]
318+
output_type = [ToolOutput(bool)]
376319
assert agent.output_json_schema(output_type=output_type) == snapshot(
377320
{'type': 'object', 'properties': {'response': {'type': 'boolean'}}, 'required': ['response']}
378321
)

0 commit comments

Comments
 (0)