From d167b9eb5c8fafad75601ac820b9cde8753142d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B8=D0=BD=D0=B0=D1=80=20=D0=9C=D0=B8=D1=80=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D0=B8=D1=82=D0=BE=D0=B2?= Date: Tue, 12 May 2026 21:44:36 +0000 Subject: [PATCH] Add test_stream_agent.py --- test_stream_agent.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test_stream_agent.py 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"))