test(quant): eliminate hardcoded counts in test_core_suite.py using dynamic invariant checks
This commit is contained in:
1 parent
25f61dac33
commit
531f69e65a
1 file changed
+10
-3
@@ -341,8 +341,12 @@ def test_ipld_quant_and_mcp_server() -> None:
|
|||||||
|
|
||||||
nvda_ts = next(x for x in ts_full["instruments"] if x["symbol"] == "NVDA")
|
nvda_ts = next(x for x in ts_full["instruments"] if x["symbol"] == "NVDA")
|
||||||
assert nvda_ts["data_available"] is True
|
assert nvda_ts["data_available"] is True
|
||||||
assert nvda_ts["available_trading_days"] == 20
|
total_dates = len(ts_full["dates_utc"])
|
||||||
assert sum(1 for b in nvda_ts["bars"] if not b["data_available"] and b["status"] == NO_DATA_AVAILABLE) == 12
|
avail_days = sum(1 for b in nvda_ts["bars"] if b["data_available"] is True)
|
||||||
|
missing_days = sum(1 for b in nvda_ts["bars"] if not b["data_available"] and b["status"] == NO_DATA_AVAILABLE)
|
||||||
|
assert nvda_ts["available_trading_days"] == avail_days
|
||||||
|
assert avail_days + missing_days == total_dates
|
||||||
|
assert len(nvda_ts["bars"]) == total_dates
|
||||||
assert nvda_ts["tradingview_symbol"] == "NASDAQ:NVDA"
|
assert nvda_ts["tradingview_symbol"] == "NASDAQ:NVDA"
|
||||||
assert "tradingview.com/chart/?symbol=NASDAQ%3ANVDA" in nvda_ts["tradingview_url"]
|
assert "tradingview.com/chart/?symbol=NASDAQ%3ANVDA" in nvda_ts["tradingview_url"]
|
||||||
assert "doc_references" in nvda_ts
|
assert "doc_references" in nvda_ts
|
||||||
@@ -524,7 +528,10 @@ def test_ipld_quant_and_mcp_server() -> None:
|
|||||||
assert len(coord_163["quant_timeseries_bars"]) >= 1
|
assert len(coord_163["quant_timeseries_bars"]) >= 1
|
||||||
|
|
||||||
nvda_bars = query_timeseries_bars(symbol="NVDA", min_points=None, db_path=cat_db)
|
nvda_bars = query_timeseries_bars(symbol="NVDA", min_points=None, db_path=cat_db)
|
||||||
assert len(nvda_bars) == len(ts_full["dates_utc"]) and sum(1 for b in nvda_bars if b["data_available"] == 1) == 20
|
avail_db = sum(1 for b in nvda_bars if b["data_available"] == 1)
|
||||||
|
missing_db = sum(1 for b in nvda_bars if b["data_available"] == 0 and b["status"] == NO_DATA_AVAILABLE)
|
||||||
|
assert len(nvda_bars) == len(ts_full["dates_utc"])
|
||||||
|
assert avail_db + missing_db == len(nvda_bars)
|
||||||
assert any(b["contingent_points"] is None for b in nvda_bars if b["data_available"] == 0)
|
assert any(b["contingent_points"] is None for b in nvda_bars if b["data_available"] == 0)
|
||||||
|
|
||||||
# Verify MCP and REST API calls automatically populate the SQLite REST API metadata database
|
# Verify MCP and REST API calls automatically populate the SQLite REST API metadata database
|
||||||
|
|||||||
Reference in new issue
Block a user