阶段4(下):LangChain 1.x、提示词与注入防护、模型侧(路由/vLLM/LoRA)、AI 编程工具与验证、Dify/Coze 专题

This commit is contained in:
Shikui Wang committed 2026-10-23 16:15:33 +08:00
1 parent caaec830b3
commit 7a32d2c9a6
38 files changed
+3059 -67

No files matched your search

@@ -0,0 +1,24 @@
# requires: pytest
"""人工补充的边界测试:AI 第一版代码在“优惠券大于金额”时返回了负数,这些测试把它拦了下来。"""
from decimal import Decimal
import pytest
from pricing import final_price
def test_normal():
assert final_price(Decimal("100"), Decimal("10"), vip=False) == Decimal("90.00")
def test_vip_rounding():
assert final_price(Decimal("10.01"), Decimal("0"), vip=True) == Decimal("9.51")
def test_coupon_larger_than_amount():
assert final_price(Decimal("5"), Decimal("10"), vip=True) == Decimal("0.00")
def test_negative_rejected():
with pytest.raises(ValueError):
final_price(Decimal("-1"), Decimal("0"), vip=False)