| from __future__ import annotations |
|
|
| import sys |
| from datetime import UTC, date, datetime |
| from pathlib import Path |
|
|
| import polars as pl |
| import pytest |
|
|
| ROOT = Path(__file__).resolve().parents[1] |
| if str(ROOT) not in sys.path: |
| sys.path.insert(0, str(ROOT)) |
|
|
|
|
| @pytest.fixture |
| def raw_announcements() -> pl.DataFrame: |
| """Three releases: after the close, before the open, and during the session.""" |
| return pl.DataFrame( |
| [ |
| {"cik": "0000320193", "accession": "a-after", "form": "8-K", "items": "2.02,9.01", |
| "filingDate": "2026-01-29", "reportDate": "2026-01-29", |
| "acceptanceDateTime": None, "primaryDocument": "d.htm", "size": "1", "isXBRL": "0"}, |
| {"cik": "0000320193", "accession": "a-pre", "form": "8-K", "items": "2.02", |
| "filingDate": "2025-10-30", "reportDate": "2025-10-30", |
| "acceptanceDateTime": None, "primaryDocument": "d.htm", "size": "1", "isXBRL": "0"}, |
| {"cik": "0000000002", "accession": "a-mid", "form": "8-K", "items": "2.02,7.01", |
| "filingDate": "2026-01-29", "reportDate": "2026-01-29", |
| "acceptanceDateTime": None, "primaryDocument": "d.htm", "size": "1", "isXBRL": "0"}, |
| ], |
| strict=False, |
| ) |
|
|
|
|
| @pytest.fixture |
| def acceptance() -> pl.DataFrame: |
| return pl.DataFrame( |
| [ |
| |
| {"accession": "a-after", "accepted_at": datetime(2026, 1, 29, 21, 30, tzinfo=UTC), |
| "status": "ok"}, |
| |
| {"accession": "a-pre", "accepted_at": datetime(2025, 10, 30, 11, 0, tzinfo=UTC), |
| "status": "ok"}, |
| |
| {"accession": "a-mid", "accepted_at": datetime(2026, 1, 29, 16, 15, tzinfo=UTC), |
| "status": "ok"}, |
| ], |
| strict=False, |
| ) |
|
|
|
|
| @pytest.fixture |
| def statements() -> pl.DataFrame: |
| """The 10-Q that follows each release, plus the year-ago quarter.""" |
| return pl.DataFrame( |
| [ |
| {"cik": "0000320193", "accession_number": "s-q1-2026", "form": "10-Q", |
| "period_end": date(2025, 12, 31), "quarters": 1, "fiscal_year": 2026, |
| "fiscal_period": "Q1", "currency": "USD", "eps_basic": 2.90, "eps_diluted": 2.84, |
| "revenue": 1.4376e11, "net_income": 4.2e10, |
| "accepted_at": datetime(2026, 1, 30, 21, 0, tzinfo=UTC)}, |
| {"cik": "0000320193", "accession_number": "s-q1-2025", "form": "10-Q", |
| "period_end": date(2024, 12, 31), "quarters": 1, "fiscal_year": 2025, |
| "fiscal_period": "Q1", "currency": "USD", "eps_basic": 2.44, "eps_diluted": 2.40, |
| "revenue": 1.2430e11, "net_income": 3.6e10, |
| "accepted_at": datetime(2025, 1, 30, 21, 0, tzinfo=UTC)}, |
| |
| |
| {"cik": "0000000002", "accession_number": "s-old", "form": "10-Q", |
| "period_end": date(2025, 9, 30), "quarters": 1, "fiscal_year": 2025, |
| "fiscal_period": "Q3", "currency": "USD", "eps_basic": 1.0, "eps_diluted": 1.0, |
| "revenue": 1.0e9, "net_income": 1.0e8, |
| "accepted_at": datetime(2025, 11, 5, 21, 0, tzinfo=UTC)}, |
| ], |
| strict=False, |
| ) |
|
|