MCPcopy
hub / github.com/openai/openai-agents-python / test_nested_data_function

Function test_nested_data_function

tests/test_function_schema.py:156–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

154
155
156def test_nested_data_function():
157 func_schema = function_schema(complex_args_function)
158 assert isinstance(func_schema.params_json_schema, dict)
159 assert func_schema.params_json_schema.get("title") == "complex_args_function_args"
160
161 # Valid input
162 model = OuterModel(inner=InnerModel(a=1, b="hello"), foo=Foo(a=2, b="world"))
163 valid_input = {
164 "model": model.model_dump(),
165 }
166
167 parsed = func_schema.params_pydantic_model(**valid_input)
168 args, kwargs_dict = func_schema.to_call_args(parsed)
169
170 result = complex_args_function(*args, **kwargs_dict)
171 assert result == "1, hello, 2, world"
172
173
174def complex_args_and_docs_function(model: OuterModel, some_flag: int = 0) -> str:

Callers

nothing calls this directly

Calls 8

function_schemaFunction · 0.90
OuterModelClass · 0.85
InnerModelClass · 0.85
to_call_argsMethod · 0.80
FooClass · 0.70
complex_args_functionFunction · 0.70
getMethod · 0.45
model_dumpMethod · 0.45

Tested by

no test coverage detected