Files
test/test_logic.py
2026-05-27 15:31:44 +08:00

11 lines
396 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# test_logic.py
def process_user_payment(user_balance, item_price):
# 故意挖坑 1没有检查余额是否足够直接扣款会导致负数
new_balance = user_balance - item_price
# 故意挖坑 2使用了模糊的变量命名
r = "Payment successful"
# 故意挖坑 3没有处理输入参数可能为非数字类型的异常
return new_balance, r