summaryrefslogtreecommitdiff
path: root/backend/tests/test_api.py
diff options
context:
space:
mode:
authorTyler Hoang <tyler@tylerhoang.xyz>2026-05-17 14:27:18 -0700
committerTyler Hoang <tyler@tylerhoang.xyz>2026-05-17 14:27:18 -0700
commit5f270f75bb73092d89fd2d797173febf8c6ed08b (patch)
treec6724d036817902db0693a042e9ad109675c890f /backend/tests/test_api.py
parentfb52ef3e4ffee2be8efadd0928223a81564ab422 (diff)
feat: add FinancialRow/Statement/Response schemas
Diffstat (limited to 'backend/tests/test_api.py')
-rw-r--r--backend/tests/test_api.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/backend/tests/test_api.py b/backend/tests/test_api.py
index 1c99cf9..5d76dfd 100644
--- a/backend/tests/test_api.py
+++ b/backend/tests/test_api.py
@@ -334,6 +334,25 @@ def test_compute_ttm_ratios_guardrails_suppress_outliers(monkeypatch) -> None:
assert "ev_to_ebitda" not in ratios
+def test_financials_schema_structure() -> None:
+ from app.schemas import FinancialRow, FinancialStatement, FinancialsResponse
+ row = FinancialRow(label="Revenue", indent=0, is_total=True, values=[1.0, 2.0, None])
+ assert row.label == "Revenue"
+ assert row.is_total is True
+ assert row.values[2] is None
+
+ stmt = FinancialStatement(columns=["FY 2024", "TTM"], rows=[row])
+ assert len(stmt.columns) == 2
+
+ resp = FinancialsResponse(
+ period="annual",
+ income=stmt,
+ balance=FinancialStatement(columns=[], rows=[]),
+ cash_flow=FinancialStatement(columns=[], rows=[]),
+ )
+ assert resp.period == "annual"
+
+
def test_overview_uses_computed_sources_and_ratios(monkeypatch) -> None:
clear_service_caches()
monkeypatch.setattr(