|
|
| import pathlib |
| from services.ocean_batch import parse_ocean_batch_request |
| ROOT=pathlib.Path(__file__).resolve().parents[1] |
|
|
| def test_version_421(): |
| assert (ROOT/"VERSION").read_text(encoding="utf-8").strip()=="4.6.15" |
|
|
| def test_exact_user_month_query_routes_to_batch(): |
| p=parse_ocean_batch_request("查询 2002 年 8 月西北太平洋的 SST 数据,并导出为 CSV 文件供我下载") |
| assert p is not None |
| assert p["start_date"]=="2002-08-01" |
| assert p["end_date"]=="2002-08-31" |
| assert p["days"]==31 |
| assert p["subtask_count"]==31 |
| assert p["variables"]==["sst"] |
| assert p["format"]=="csv" |
| assert p["region_name"]=="西北太平洋" |
| assert p["region_source"]=="platform_standard" |
| assert p["bbox"]=={"lon_min":120.0,"lon_max":180.0,"lat_min":0.0,"lat_max":60.0} |
|
|
| def test_explicit_coordinates_override_named_region(): |
| p=parse_ocean_batch_request("导出 2002年8月西北太平洋 130°E-140°E 20°N-30°N SST 为 CSV") |
| assert p is not None |
| assert p["bbox"]=={"lon_min":130.0,"lon_max":140.0,"lat_min":20.0,"lat_max":30.0} |
| assert p["region_source"]=="explicit_coordinates" |
|
|
| def test_single_day_remains_normal_export(): |
| p=parse_ocean_batch_request("导出 2002-08-01 西北太平洋 SST 为 CSV") |
| assert p is None |
|
|
| def test_chat_fast_path_promises_no_single_day_reprompt(): |
| rt=(ROOT/"services"/"chat_runtime.py").read_text(encoding="utf-8") |
| assert "不会再要求您补充某一天" in rt |
| assert "parse_ocean_batch_request(prompt)" in rt |
|
|