summaryrefslogtreecommitdiff
path: root/shared/tests/test_sentiment_aggregator.py
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-02 15:54:55 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-02 15:54:55 +0900
commitbf4afbc0a3cc4e847ef01840365fd6a6ae9c142f (patch)
treec8634b3b21534f550e2d255d98c4a068a1b567d0 /shared/tests/test_sentiment_aggregator.py
parentec8b6fea5a4a710df4b2ae18f3f399d165c8ffd4 (diff)
style: auto-fix lint violations from enhanced ruff rules
Diffstat (limited to 'shared/tests/test_sentiment_aggregator.py')
-rw-r--r--shared/tests/test_sentiment_aggregator.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/shared/tests/test_sentiment_aggregator.py b/shared/tests/test_sentiment_aggregator.py
index a99c711..9193785 100644
--- a/shared/tests/test_sentiment_aggregator.py
+++ b/shared/tests/test_sentiment_aggregator.py
@@ -1,7 +1,9 @@
"""Tests for sentiment aggregator."""
+from datetime import UTC, datetime, timedelta
+
import pytest
-from datetime import datetime, timezone, timedelta
+
from shared.sentiment import SentimentAggregator
@@ -12,25 +14,25 @@ def aggregator():
def test_freshness_decay_recent():
a = SentimentAggregator()
- now = datetime.now(timezone.utc)
+ now = datetime.now(UTC)
assert a._freshness_decay(now, now) == 1.0
def test_freshness_decay_3_hours():
a = SentimentAggregator()
- now = datetime.now(timezone.utc)
+ now = datetime.now(UTC)
assert a._freshness_decay(now - timedelta(hours=3), now) == 0.7
def test_freshness_decay_12_hours():
a = SentimentAggregator()
- now = datetime.now(timezone.utc)
+ now = datetime.now(UTC)
assert a._freshness_decay(now - timedelta(hours=12), now) == 0.3
def test_freshness_decay_old():
a = SentimentAggregator()
- now = datetime.now(timezone.utc)
+ now = datetime.now(UTC)
assert a._freshness_decay(now - timedelta(days=2), now) == 0.0
@@ -44,7 +46,7 @@ def test_compute_composite():
def test_aggregate_news_by_symbol(aggregator):
- now = datetime.now(timezone.utc)
+ now = datetime.now(UTC)
news_items = [
{"symbols": ["AAPL"], "sentiment": 0.8, "category": "earnings", "published_at": now},
{
@@ -64,7 +66,7 @@ def test_aggregate_news_by_symbol(aggregator):
def test_aggregate_empty(aggregator):
- now = datetime.now(timezone.utc)
+ now = datetime.now(UTC)
assert aggregator.aggregate([], now) == {}