Test Overview
This test checks if a function correctly doubles a single input number. It verifies the output matches the expected doubled value.
This test checks if a function correctly doubles a single input number. It verifies the output matches the expected doubled value.
import pytest def double(x): return x * 2 @pytest.mark.parametrize('input_value, expected', [ (2, 4), (5, 10), (0, 0), (-3, -6) ]) def test_double(input_value, expected): result = double(input_value) assert result == expected, f"Expected {expected} but got {result}"
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | pytest test runner initialized | - | PASS |
| 2 | pytest collects test_double with 4 parameter sets | Test cases ready to run with inputs (2,4), (5,10), (0,0), (-3,-6) | - | PASS |
| 3 | Runs test_double with input_value=2, expected=4 | Function double called with 2 | Check if double(2) == 4 | PASS |
| 4 | Runs test_double with input_value=5, expected=10 | Function double called with 5 | Check if double(5) == 10 | PASS |
| 5 | Runs test_double with input_value=0, expected=0 | Function double called with 0 | Check if double(0) == 0 | PASS |
| 6 | Runs test_double with input_value=-3, expected=-6 | Function double called with -3 | Check if double(-3) == -6 | PASS |
| 7 | All parameterized tests completed | All assertions passed | - | PASS |