41 lines
1.5 KiB
Python
41 lines
1.5 KiB
Python
|
|
"""恢复库核对包不能用缺记录证明零运费、已发绩效或已确认零期初。"""
|
|||
|
|
|
|||
|
|
from app.services.tplus.materials import QUERIES, render_markdown, summarize
|
|||
|
|
|
|||
|
|
|
|||
|
|
def records():
|
|||
|
|
data = {name: [] for name in QUERIES}
|
|||
|
|
data["customer"] = [{"id": 9395, "code": "0060201", "name": "测试客户", "customerType": None}]
|
|||
|
|
return data
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_缺初始化记录只形成候选余额():
|
|||
|
|
report = summarize(records(), 9395, "2026-03")
|
|||
|
|
assert report["opening_candidate"] == "0.00" and not report["opening_confirmed"]
|
|||
|
|
assert not report["ready_for_amount"] and not report["formal_payroll_written"]
|
|||
|
|
assert {m["key"] for m in report["missing"]} >= {"GUIDANCE", "FREIGHT", "HISTORICAL_PAYROLL"}
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_2017初始化不直接当作切换余额():
|
|||
|
|
data = records()
|
|||
|
|
data["opening"] = [{"origDate": "2017-05-31", "amount": "10000"}]
|
|||
|
|
report = summarize(data, 9395, "2026-03")
|
|||
|
|
assert report["opening_candidate"] is None
|
|||
|
|
assert "2026-02-28" in report["opening_explanation"]
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_超过范围明确标记核对包不完整():
|
|||
|
|
data = records()
|
|||
|
|
data["items"] = [{"id": i} for i in range(201)]
|
|||
|
|
report = summarize(data, 9395, "2026-03")
|
|||
|
|
assert report["truncated"] == ["items"]
|
|||
|
|
assert len(report["evidence"]["items"]) == 200
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_报告明确待补不制造实际金额():
|
|||
|
|
report = summarize(records(), 9395, "2026-03")
|
|||
|
|
report["evidence_hash"] = "test"
|
|||
|
|
output = render_markdown(report)
|
|||
|
|
assert "候选期初余额:0.00" in output
|
|||
|
|
assert "实际工资金额尚未验收" in output
|