Normalize persisted test timestamps
This commit is contained in:
@@ -30,6 +30,10 @@ from app.models.sentiment import SentimentScore
|
||||
from app.services.rr_scanner_service import scan_ticker, get_trade_setups
|
||||
|
||||
|
||||
def _as_utc(value: datetime) -> datetime:
|
||||
return value if value.tzinfo is not None else value.replace(tzinfo=timezone.utc)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Session fixtures
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -753,10 +757,10 @@ async def test_live_overlay_preserves_setup_specific_risk_and_context(
|
||||
"target-availability: Fewer than 3 valid S/R targets available"
|
||||
]
|
||||
assert row["current_price"] == pytest.approx(101.0)
|
||||
assert row["context_as_of"]["score_computed_at"] == current
|
||||
assert row["context_as_of"]["sentiment_at"] == current
|
||||
assert _as_utc(row["context_as_of"]["score_computed_at"]) == current
|
||||
assert _as_utc(row["context_as_of"]["sentiment_at"]) == current
|
||||
assert row["context_as_of"]["price_date"] == date(2026, 7, 3)
|
||||
assert row["context_as_of"]["price_updated_at"] == current
|
||||
assert _as_utc(row["context_as_of"]["price_updated_at"]) == current
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user