Skip to content

Commit 2136315

Browse files
author
jhengy
committed
Create test_llm.py
1 parent 0ec8e5a commit 2136315

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/test_llm.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import pytest
2+
from content_aggregator.llm import LLMProcessor
3+
4+
# NOTE: these test reqire GEMINI_API_KEY environment variable and will fire api calls
5+
6+
@pytest.fixture
7+
def live_processor():
8+
# Requires GEMINI_API_KEY environment variable
9+
return LLMProcessor()
10+
11+
@pytest.mark.external
12+
@pytest.mark.asyncio
13+
async def test_live_summarize_post(live_processor):
14+
"""Integration test with real Gemini API (requires API key)"""
15+
article_text = """Seagate has responded to queries about used hard drives being sold as new..."""
16+
17+
result = await live_processor.summarize_post(
18+
article_text,
19+
"https://example.com/article"
20+
)
21+
22+
assert result.get('url') == "https://example.com/article"
23+
assert result.get('title') != live_processor.UNKNOWN
24+
assert result.get('summary') != "No summary generated"
25+
assert len(result.get('tags')) > 0
26+
27+
@pytest.mark.external
28+
@pytest.mark.asyncio
29+
async def test_live_summarize_all(live_processor):
30+
"""Integration test for summary aggregation"""
31+
input_summaries = [
32+
"Recent findings show unexpected failure rates in storage hardware",
33+
"New industry report reveals growing concerns about refurbished components"
34+
]
35+
36+
result = await live_processor.summarize_all(input_summaries)
37+
38+
assert len(result) > 100 # Should generate substantial summary
39+
assert any(word in result.lower() for word in ["insights", "trends", "implications"])

0 commit comments

Comments
 (0)