feat(factor): upsert_factor 条目级 description——仅建条落盘幂等不覆盖 [vps]
This commit is contained in:
@@ -318,3 +318,17 @@ def test_upsert_idempotent_return_does_not_overwrite_origin(reg):
|
||||
again = upsert_factor(reg, "fa_x", "hyp-4", origin="decomposer")
|
||||
assert again is first
|
||||
assert "origin" not in reg["factors"]["fa_x"] # 幂等返回不补写
|
||||
|
||||
|
||||
def test_upsert_factor_description_built_once_not_overwritten(reg):
|
||||
"""2026-10-09 补丁:description 条目级自述,仅建条落盘,幂等不覆盖."""
|
||||
e1 = upsert_factor(reg, "f1", "H-1",
|
||||
description="20日均值动量,股价延续性的量度")
|
||||
assert e1["description"] == "20日均值动量,股价延续性的量度"
|
||||
# 同名同假设幂等返回:换 description 入参也不覆盖(改描述走升版本)
|
||||
e2 = upsert_factor(reg, "f1", "H-1", description="新描述不应生效")
|
||||
assert e2 is e1
|
||||
assert reg["factors"]["f1"]["description"] == "20日均值动量,股价延续性的量度"
|
||||
# 不传 description=条目无该键(存量因子形态)
|
||||
upsert_factor(reg, "f2", "H-2")
|
||||
assert "description" not in reg["factors"]["f2"]
|
||||
|
||||
Reference in New Issue
Block a user