"""合成供应商响应与补拉;不发网络请求。""" import json sessions = ["2026-10-19", "2026-10-20", "2026-10-21"] responses = {"AAA": sessions[:], "BBB": sessions[1:], "CCC": None} store, retry, coverage = {}, {}, {} for symbol, response in responses.items(): store[symbol] = set(response or []) missing = sorted(set(sessions) - store[symbol]) coverage[symbol] = {"status": "failed" if response is None else "partial" if missing else "success", "rows": len(store[symbol]), "missing": missing} if missing: retry[symbol] = missing assert coverage["AAA"]["status"] == "success" assert coverage["BBB"]["status"] == "partial" assert coverage["CCC"]["status"] == "failed" for symbol, dates in retry.items(): store[symbol].update(dates) store[symbol].update(dates) assert all(len(dates) == 3 for dates in store.values()) assert len(retry) == 2 print(json.dumps({"initial": coverage, "retry": retry, "after_rows": {s: len(v) for s, v in store.items()}}, sort_keys=True))