mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
* fix route introspection for fastapi 0.137 * recapture oeccd gdp forecast test cassette --------- Co-authored-by: deeleeramone <>
42 lines
1.1 KiB
Python
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)
|