forked from openai/openai-agents-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_run.py
More file actions
26 lines (17 loc) · 681 Bytes
/
Copy pathtest_run.py
File metadata and controls
26 lines (17 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from __future__ import annotations
from unittest import mock
import pytest
from agents import Agent, Runner
from agents.run import AgentRunner, set_default_agent_runner
from .fake_model import FakeModel
@pytest.mark.asyncio
async def test_static_run_methods_call_into_default_runner() -> None:
runner = mock.Mock(spec=AgentRunner)
set_default_agent_runner(runner)
agent = Agent(name="test", model=FakeModel())
await Runner.run(agent, input="test")
runner.run.assert_called_once()
Runner.run_streamed(agent, input="test")
runner.run_streamed.assert_called_once()
Runner.run_sync(agent, input="test")
runner.run_sync.assert_called_once()