Test Overview
This test checks if the function add_numbers correctly adds two numbers and returns the expected result.
This test checks if the function add_numbers correctly adds two numbers and returns the expected result.
import pytest def add_numbers(a, b): return a + b def test_add_numbers(): result = add_numbers(3, 4) assert result == 7, f"Expected 7 but got {result}"
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | PyTest test runner initialized | — | PASS |
| 2 | PyTest discovers test function 'test_add_numbers' | Test function ready to run | — | PASS |
| 3 | Calls function add_numbers(3, 4) | Function executes and returns 7 | — | PASS |
| 4 | Assert that result == 7 | Result is 7 | Check if 7 equals 7 | PASS |
| 5 | Test completes successfully | Test passed with no errors | — | PASS |
def test_sum():
result = 2 + 3
assert result == 5def test_multiply():
result = 4 * 5
assert result = 20def max_number(numbers):
return max(numbers)
# Choose the correct test function:Pass the test and this pattern moves unknown