24 lines
700 B
Python
24 lines
700 B
Python
"""sanitize_postprocess 分治(1B)单测。"""
|
|||
|
|
|
||
|
|
from app.utils.compliance_guard import COMPLIANCE_REJECT
|
||
|
|
from app.utils.sanitize_postprocess import finalize_sanitized_reply
|
||
|
|
|
||
|
|
|
||
|
|
def test_data_query_falls_back_to_fact_text():
|
||
|
|
reply, transfer = finalize_sanitized_reply(
|
||
|
|
"建议您买入",
|
||
|
|
intent="holding_query",
|
||
|
|
fact_text="您当前持有 3 只产品。",
|
||
|
|
)
|
||
|
|
assert transfer is False
|
||
|
|
assert "3 只产品" in reply
|
||
|
|
|
||
|
|
|
||
|
|
def test_rag_hit_returns_compliance_without_transfer():
|
||
|
|
reply, transfer = finalize_sanitized_reply(
|
||
|
|
"建议您买入更多",
|
||
|
|
intent="product_consult",
|
||
|
|
)
|
||
|
|
assert transfer is False
|
||
|
|
assert reply == COMPLIANCE_REJECT
|