Custom coding instructions for AI Agents - Guidelines
test_addition_returns_correct_sum.setUp() and tearDown() (or fixtures in pytest) to prepare and clean up test environments.unittest.mock or pytest-mock to isolate the unit under test from external systems (e.g., databases, APIs).None, zero, negative numbers, etc.?Here’s a checklist of things to test in a typical Python function or module:
| Test Type | What to Check |
|---|---|
| Correctness | Does the function return the expected output for valid inputs? |
| Edge Cases | What happens with empty lists, None, zero, negative numbers, etc.? |
| Error Handling | Does it raise the correct exceptions for invalid inputs? |
| Performance (optional) | Is it fast enough for large inputs? (usually not in unit tests) |
| Side Effects | Does it modify global state, write to disk, or call external services? |
| Integration Points | If it interacts with other modules, are those interactions correct? |