feat: technical, news, and social analysis agents
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
31
tests/test_news_agent.py
Normal file
31
tests/test_news_agent.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import pytest
|
||||
from agents.news import NewsAgent
|
||||
|
||||
def test_score_positive_news():
|
||||
agent = NewsAgent()
|
||||
articles = [
|
||||
{"title": "Bitcoin surges 10%", "sentiment_votes": {"positive": 10, "negative": 1}},
|
||||
{"title": "BTC adoption grows", "sentiment_votes": {"positive": 8, "negative": 2}},
|
||||
{"title": "Bitcoin rally continues", "sentiment_votes": {"positive": 15, "negative": 0}},
|
||||
]
|
||||
score = agent.analyze(articles)
|
||||
assert score >= 70
|
||||
|
||||
def test_score_negative_news():
|
||||
agent = NewsAgent()
|
||||
articles = [
|
||||
{"title": "Bitcoin crashes hard", "sentiment_votes": {"positive": 1, "negative": 10}},
|
||||
{"title": "Crypto market in fear", "sentiment_votes": {"positive": 0, "negative": 15}},
|
||||
]
|
||||
score = agent.analyze(articles)
|
||||
assert score <= 35
|
||||
|
||||
def test_score_no_news_returns_50():
|
||||
agent = NewsAgent()
|
||||
assert agent.analyze([]) == 50
|
||||
|
||||
def test_score_mixed_news():
|
||||
agent = NewsAgent()
|
||||
articles = [{"title": "BTC up", "sentiment_votes": {"positive": 5, "negative": 5}}]
|
||||
score = agent.analyze(articles)
|
||||
assert 40 <= score <= 60
|
||||
Reference in New Issue
Block a user