feat: improve campus bike discovery and add independent live preview

This commit is contained in:
zzy
2026-11-04 16:42:47 +08:00
parent f986c8deae
commit b6b7b3dbe5
42 changed files with 5267 additions and 4313 deletions
+4 -4
View File
@@ -60,8 +60,8 @@ check("freshness stale 为数字", isinstance(d["stale_seconds"], int))
r = client.get("/api/history/stats?days=1").get_json()["data"]
check("stats days=1 回显", r["days"] == 1)
check("stats 24桶", "00" in r["hourly_distribution"] and "23" in r["hourly_distribution"])
expected_states = {"available", "used", "locked", "reserved", "low"}
check("stats 桶含5状态", set(r["hourly_distribution"]["08"].keys()) == expected_states)
expected_states = {"available", "used", "locked", "reserved", "low", "unknown"}
check("stats 桶含6状态", set(r["hourly_distribution"]["08"].keys()) == expected_states)
# ---- stats days=30 ----
r = client.get("/api/history/stats?days=30").get_json()["data"]
@@ -100,7 +100,7 @@ check("days=0 收敛1", r["days"] == 1)
Path(handle.name).unlink(missing_ok=True)
print(f"RESULT: {{'FAIL' if failures else 'ALL PASS'}} ({{len(failures)}} failures)")
sys.exit(1 if failures else 0)
'''.replace("{root}", str(ROOT).replace("\\", "\\\\"))
'''.replace("{root}", str(ROOT).replace("\\", "\\\\")).replace("{{", "{").replace("}}", "}")
def test_history_30d_contract():
@@ -109,4 +109,4 @@ def test_history_30d_contract():
cwd=str(ROOT))
out = (r.stdout or "") + (r.stderr or "")
print(out[-4000:] if len(out) > 4000 else out)
assert r.returncode == 0, "子进程契约验证失败(见上方输出)"
assert r.returncode == 0, "子进程契约验证失败(见上方输出)"