import ast from pathlib import Path def _planner_source(): src = Path(__file__).resolve().parents[1].joinpath('services', 'project_planner.py').read_text(encoding='utf-8') tree = ast.parse(src) for node in tree.body: if isinstance(node, ast.FunctionDef) and node.name == '_project_package_plan': return ast.get_source_segment(src, node) or '' raise AssertionError('planner not found') def test_eddy_intent_is_first_class_and_fisheries_not_default_fallback(): src = _planner_source() assert '中尺度涡旋' in src assert '物理海洋过程研究' in src assert 'SSH / SLA' in src assert '地转流 / 海流 U-V' in src assert '默认先提供海洋环境背景,不自动引入无关渔业数据' in src def test_generic_pacific_is_recognized_without_unsafe_cross_dateline_bbox(): src = _planner_source() assert '(("太平洋", "pacific"), [], "太平洋")' in src assert '更精确的太平洋子区域/经纬度范围' in src