Test Overview
This test checks that a function returns the same output every time it is called with the same input. It verifies the test is deterministic, meaning it does not depend on random or changing data.
This test checks that a function returns the same output every time it is called with the same input. It verifies the test is deterministic, meaning it does not depend on random or changing data.
import pytest def add_five(x): return x + 5 def test_add_five_deterministic(): result1 = add_five(10) result2 = add_five(10) assert result1 == result2 assert result1 == 15
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | pytest test runner initialized | - | PASS |
| 2 | Calls add_five(10) first time | Function add_five executes with input 10 | No assertion yet | PASS |
| 3 | Calls add_five(10) second time | Function add_five executes again with input 10 | No assertion yet | PASS |
| 4 | Assert result1 equals result2 | Both results are 15 | assert 15 == 15 | PASS |
| 5 | Assert result1 equals 15 | result1 is 15 | assert 15 == 15 | PASS |
| 6 | Test ends successfully | All assertions passed | - | PASS |