diff --git a/test_stream_agent.py b/test_stream_agent.py new file mode 100644 index 0000000..901a0a2 --- /dev/null +++ b/test_stream_agent.py @@ -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"))