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

Function test_function_with_context

tests/test_function_schema.py:229–240  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227
228
229def test_function_with_context():
230 func_schema = function_schema(function_with_context)
231 assert func_schema.takes_context
232
233 context = RunContextWrapper(context="test")
234
235 input = {"a": 1, "b": 2}
236 parsed = func_schema.params_pydantic_model(**input)
237 args, kwargs_dict = func_schema.to_call_args(parsed)
238
239 result = function_with_context(context, *args, **kwargs_dict)
240 assert result == 3
241
242
243class MyClass:

Callers

nothing calls this directly

Calls 4

function_schemaFunction · 0.90
RunContextWrapperClass · 0.90
function_with_contextFunction · 0.85
to_call_argsMethod · 0.80

Tested by

no test coverage detected