Add test_stream_agent.py

This commit is contained in:
2026-05-12 21:44:36 +00:00
parent 225e89bcdf
commit d167b9eb5c
+18
View File
@@ -0,0 +1,18 @@
from stream_agent import StreamingAIAgent
def test_stream_returns_chunks(monkeypatch):
monkeypatch.delenv("OPENAI_API_KEY", raising=False)
agent = StreamingAIAgent()
chunks = list(agent.stream("test question"))
assert len(chunks) > 3
assert "".join(chunks).strip()
def test_invoke_matches_stream(monkeypatch):
monkeypatch.delenv("OPENAI_API_KEY", raising=False)
agent = StreamingAIAgent()
assert agent.invoke("hello") == "".join(agent.stream("hello"))