Tests pass but miss bug
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:
The 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?
discount_amount(price: int, pct_bps: int) → int[100,1000]out90[95,1000]out86[99,1000]out89Treat 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 & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.