test: 真人验收清单+API级联调验收
真实 GLM 五轮实跑(EN/ES/ZH/换号/敏感问)+mock推送+admin三视图,核心项全过。 修复: 中文轮漂英文→语言跟随提醒; extractor裸字符串联系方式→500崩溃兜形; 号码回显/样品承诺/标记词泄漏 prompt加固; 测试env耦合断言; .env前缀对齐。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,21 @@ def test_normalize_later_alias_wins_on_same_key():
|
||||
assert normalize_contacts({"手机": "1111111", "tel": "2222222"}) == {"phone": "2222222"}
|
||||
|
||||
|
||||
def test_normalize_coerces_bare_string_extractor_output():
|
||||
# Task 11 真人验收实测: 真实 GLM extractor 偶发把联系方式压成裸字符串
|
||||
# (mock 测不出)——唯一事实源处兜形,不崩溃不丢号:
|
||||
# 含 @ → email;裸号码 → phone;列表逐项;其他非 dict 按空
|
||||
assert normalize_contacts("+966 50 123 4567") == {"phone": "+966 50 123 4567"}
|
||||
assert normalize_contacts("buyer@example.com") == {"email": "buyer@example.com"}
|
||||
assert normalize_contacts(["+966501234567", "a@b.com"]) == {
|
||||
"phone": "+966501234567", "email": "a@b.com"}
|
||||
assert normalize_contacts(" ") == {}
|
||||
assert normalize_contacts(12345) == {}
|
||||
# merge_contacts 两侧裸串同样不崩、正常深合并
|
||||
assert merge_contacts("+966501234567", {"whatsapp": "+966509876543"}) == {
|
||||
"phone": "+966501234567", "whatsapp": "+966509876543"}
|
||||
|
||||
|
||||
def test_merge_new_value_wins_same_key():
|
||||
old = {"phone": "+254700000000"}
|
||||
new = {"手机": "+254711111111"} # 客户改号
|
||||
|
||||
Reference in New Issue
Block a user