Files
OpenBB/openbb_platform/extensions/quantitative/tests/test_router.py
Danglewood d8bab38d57 [V5] [BugFix] Fix for Breaking Changes in FastAPI 0.137+ (#7537)
* fix route introspection for fastapi 0.137

* recapture oeccd gdp forecast test cassette

---------

Co-authored-by: deeleeramone <>
2026-06-18 08:35:41 -07:00

42 lines
1.1 KiB
Python

"""Tests for ``openbb_quantitative.router`` - the aggregating router."""
from openbb_core.app.router import Router
from openbb_quantitative.router import router
EXPECTED_ROUTES = {
"/normality",
"/capm",
"/unitroot_test",
"/summary",
"/factors",
"/risk_decomposition",
"/attribution",
"/rolling/skew",
"/rolling/variance",
"/rolling/stdev",
"/rolling/kurtosis",
"/rolling/mean",
"/rolling/quantile",
"/rolling/factors",
"/stats/skew",
"/stats/variance",
"/stats/stdev",
"/stats/kurtosis",
"/stats/mean",
"/stats/quantile",
"/performance/omega_ratio",
"/performance/sharpe_ratio",
"/performance/sortino_ratio",
}
def test_router_aggregates_every_command():
"""The top-level router wires every quantitative command exactly once."""
from openbb_core.app.route_iter import iter_api_routes
assert isinstance(router, Router)
paths = [r.path for r in iter_api_routes(router.api_router)]
assert set(paths) == EXPECTED_ROUTES
assert len(paths) == len(EXPECTED_ROUTES)