diff options
Diffstat (limited to 'shared/tests/test_sentiment_aggregator.py')
| -rw-r--r-- | shared/tests/test_sentiment_aggregator.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/shared/tests/test_sentiment_aggregator.py b/shared/tests/test_sentiment_aggregator.py index f9277e7..a99c711 100644 --- a/shared/tests/test_sentiment_aggregator.py +++ b/shared/tests/test_sentiment_aggregator.py @@ -1,4 +1,5 @@ """Tests for sentiment aggregator.""" + import pytest from datetime import datetime, timezone, timedelta from shared.sentiment import SentimentAggregator @@ -35,7 +36,9 @@ def test_freshness_decay_old(): def test_compute_composite(): a = SentimentAggregator() - composite = a._compute_composite(news_score=0.5, social_score=0.3, policy_score=0.8, filing_score=0.2) + composite = a._compute_composite( + news_score=0.5, social_score=0.3, policy_score=0.8, filing_score=0.2 + ) expected = 0.5 * 0.3 + 0.3 * 0.2 + 0.8 * 0.3 + 0.2 * 0.2 assert abs(composite - expected) < 0.001 @@ -44,7 +47,12 @@ def test_aggregate_news_by_symbol(aggregator): now = datetime.now(timezone.utc) news_items = [ {"symbols": ["AAPL"], "sentiment": 0.8, "category": "earnings", "published_at": now}, - {"symbols": ["AAPL"], "sentiment": 0.3, "category": "macro", "published_at": now - timedelta(hours=2)}, + { + "symbols": ["AAPL"], + "sentiment": 0.3, + "category": "macro", + "published_at": now - timedelta(hours=2), + }, {"symbols": ["MSFT"], "sentiment": -0.5, "category": "policy", "published_at": now}, ] scores = aggregator.aggregate(news_items, now) |
