fix(sector-radar): 兼容停牌时段为空

This commit is contained in:
yuxuanhui
2026-08-31 09:47:09 +08:00
parent 1e15e8059d
commit 73e7056fcf
3 changed files with 44 additions and 3 deletions
@@ -333,6 +333,47 @@ def test_stock_basic_explicitly_requests_all_lifecycle_statuses() -> None:
assert [call[1]["list_status"] for call in client.calls] == ["L", "D", "P", "G", "UN"]
def test_suspend_timing_may_be_missing_while_suspend_type_remains_required() -> None:
client = QueryClient(
{
(
"suspend_d",
"",
): (
{
"ts_code": "000001.SZ",
"trade_date": "20260828",
"suspend_timing": None,
"suspend_type": "S",
},
)
}
)
result = make_adapter(client).fetch_suspensions(TARGET_DATE)
assert result.rows[0].suspend_timing is None
assert result.rows[0].suspend_type == "S"
missing_type = QueryClient(
{
(
"suspend_d",
"",
): (
{
"ts_code": "000001.SZ",
"trade_date": "20260828",
"suspend_timing": None,
"suspend_type": None,
},
)
}
)
with pytest.raises(SourceContractError, match="suspend_type must be a non-empty string"):
make_adapter(missing_type).fetch_suspensions(TARGET_DATE)
def test_source_snapshot_hash_is_order_stable_and_excludes_token_params() -> None:
first = build_source_snapshot(
api_name="daily",