测试按 PMS 自己的代码形态取键
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
0724509624
commit
3c186ac217
|
|
@ -87,14 +87,15 @@ def test_judge_whitelist():
|
|||
def test_positions_view():
|
||||
payload = {"date": "2026-09-09", "states": [{"code": "SH601126", "state": "逻辑成立", "why": None, "as_of": "2026-09-08",
|
||||
"reasons": ["a"], "company_review": _cr(), "company_review_text": "公司深度:质地好…"}]}
|
||||
st = pf.parse_logic_states(payload)["SH601126"]
|
||||
parsed = pf.parse_logic_states(payload)
|
||||
key, st = next(iter(parsed.items())) # 键是 PMS 自己的代码形态 (normalize_code), 不猜
|
||||
assert st["company_review"]["overall"] == "好" and st["company_review_text"].startswith("公司深度")
|
||||
v = lss.company_view(st)
|
||||
assert v["overall"] == "好" and "质地好" in v["line"] and v["invalidation"] == "下一期看现金流" and v["report_url"]
|
||||
assert lss.company_view({"state": "逻辑成立"}) is None
|
||||
rows = [{"ts_code": "SH601126", "total_qty": 0}]
|
||||
rows = [{"ts_code": key, "total_qty": 0}]
|
||||
with _Patch() as p:
|
||||
p(lss, "state_map", lambda: {"SH601126": st})
|
||||
p(lss, "state_map", lambda: {key: st})
|
||||
lss.decorate_positions(rows)
|
||||
assert rows[0]["company"]["overall"] == "好"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue