Question
You asked an AI agent to add tests for a Python `discount(price, pct)` that you suspect is buggy. The function rounds with `int(price * (1 - pct))` (truncating, not rounding). The agent ran the code, observed outputs, and wrote tests that pass. Here's one:
def test_discount_ten_percent(): # 100 with 10% off should be 90 assert discount(100, 0.10) == 90 def test_discount_fractional(): assert discount(99, 0.10) == discount(99, 0.10) assert discount(99, 0.10) == 89 # observed valueThe second test passes and coverage is now 100%. Why should you not trust these tests, and what would a meaningful test for this function look like?
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.