Skip to content

Commit 84205db

Browse files
committed
Adding unit tests
1 parent 8c1bbd9 commit 84205db

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

tests/mcp/test_resources_server.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import pytest
22
from pydantic import AnyUrl
33

4-
from agents import Agent, Runner
5-
64
from .helpers import FakeMCPServer
75

86

@@ -45,27 +43,3 @@ async def test_read_resource_not_found():
4543
uri = "docs://api/reference"
4644
with pytest.raises(KeyError, match=f"Resource {uri} not found"):
4745
await server.read_resource(AnyUrl(uri))
48-
49-
@pytest.mark.asyncio
50-
@pytest.mark.parametrize("streaming", [False, True])
51-
async def test_agent_with_resources(streaming: bool):
52-
"""Test agent with resources"""
53-
server = FakeMCPServer()
54-
55-
agent = Agent(
56-
name="Assistant",
57-
instructions="Answer users queries using the available resources",
58-
mcp_servers=[server],
59-
)
60-
61-
message = "What's the process to access the APIs?"
62-
if streaming:
63-
streaming_result = Runner.run_streamed(agent, input=message)
64-
async for _ in streaming_result.stream_events():
65-
pass
66-
final_result = streaming_result.final_output
67-
else:
68-
result = await Runner.run(agent, input=message)
69-
final_result = result.final_output
70-
71-
assert final_result is not None

0 commit comments

Comments
 (0)