Files
crypto_news_trading/tests/test_social_agent.py
2026-03-20 17:52:51 +09:00

20 lines
648 B
Python

import pytest
from agents.social import SocialAgent
def test_score_bullish_social():
agent = SocialAgent()
sentiment = {"positive": 8, "negative": 1, "neutral": 1, "total": 10}
score = agent.analyze(sentiment, mention_trend=2.5)
assert score >= 70
def test_score_bearish_social():
agent = SocialAgent()
sentiment = {"positive": 1, "negative": 8, "neutral": 1, "total": 10}
score = agent.analyze(sentiment, mention_trend=0.5)
assert score <= 35
def test_no_data_returns_50():
agent = SocialAgent()
score = agent.analyze({"positive": 0, "negative": 0, "neutral": 0, "total": 0}, 1.0)
assert score == 50