fix: 样本上的空运费按空返回,避免顺丰月结显示成 0
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
dd00dba39c
commit
d67965aae2
2 files changed
+34
-6
No files matched your search
@@ -211,3 +211,18 @@ def test_amount_serializer_keeps_null_instead_of_zero():
|
||||
assert admin["freightAmountLabel"] == "月结"
|
||||
assert market["freightAmount"] is None
|
||||
assert market["freightAmountLabel"] == "月结"
|
||||
|
||||
|
||||
def test_sample_card_payload_keeps_null_amount():
|
||||
from app.crud.sample_freight import freight_amount_payload
|
||||
|
||||
monthly = freight_amount_payload(None, "sfkd", True)
|
||||
assert monthly["freightAmount"] is None
|
||||
assert monthly["freightAmountLabel"] == "月结"
|
||||
assert freight_amount_payload(None, "sfkd", False)["freightAmount"] is None
|
||||
assert freight_amount_payload(None, "zxc", True)["freightAmountLabel"] == ""
|
||||
|
||||
numeric = freight_amount_payload(Decimal("88"), "zxc", True)
|
||||
assert numeric["freightAmount"] == "88.00"
|
||||
assert numeric["freightAmountLabel"] == "88.00"
|
||||
assert freight_amount_payload(Decimal("0"), "zxc", False)["freightAmount"] == 0.0
|
||||
Reference in new issue
Block a user