market-assistant/backend/pipeline/tests/test_strategy_config.py
hub-gif 1229e49dbe refactor(frontend): 策略生成默认大模型,仅保留「本次规则稿」选项
移除「使用大模型」与保存策略偏好;buildPayload 默认 generator=llm;勾选本次仅规则稿时走 rules。后端默认 use_llm_default 改为 true。

Made-with: Cursor
2026-04-17 16:44:15 +08:00

23 lines
694 B
Python

"""策略页独立 ``strategy_config`` 校验。"""
from __future__ import annotations
import pytest
from rest_framework import serializers
from pipeline.serializers import validate_strategy_config_body
def test_validate_strategy_config_merges_default() -> None:
out = validate_strategy_config_body({})
assert out["use_llm_default"] is True
def test_validate_strategy_config_unknown_key() -> None:
with pytest.raises(serializers.ValidationError):
validate_strategy_config_body({"foo": 1})
def test_validate_strategy_config_use_llm_type() -> None:
with pytest.raises(serializers.ValidationError):
validate_strategy_config_body({"use_llm_default": "yes"})