from pathlib import Path ROOT=Path(__file__).resolve().parents[1] def test_version(): assert (ROOT/"VERSION").read_text(encoding="utf-8").strip()=="4.6.15" def test_guard_is_before_auth_and_dispatch(): chat=(ROOT/"routes"/"chat.py").read_text(encoding="utf-8") g=chat.index("clarification=_route_ocean_missing_date_clarification") a=chat.index("uid,_auth_user=await resolve_request_user", g) d=chat.index("stream=_stream_with_heartbeat", g) assert g < a < d def test_named_region_needs_only_date(): chat=(ROOT/"routes"/"chat.py").read_text(encoding="utf-8") assert "区域和经纬度范围已经确定,不需要再次提供坐标" in chat assert "输出格式不是必填项;未指定时默认使用 NetCDF" in chat assert 'missing_fields":["date"]' in chat def test_frontend_removes_progress_for_clarification(): js=(ROOT/"static"/"js"/"app.js").read_text(encoding="utf-8") assert 'querySelectorAll(".chat-task-progress").forEach(box=>box.remove())' in js assert "ctx.done=true" in js