Summary
Provide a reference test template that demonstrates best practices for AI agents to follow when writing tests.
Goal
AI agents need concrete examples of:
- Traditional unit tests
- Property-based tests with Hypothesis
- Parametrized tests
- Integration tests
- Proper fixture usage
Tasks
1. Create Template File
2. Test Pattern Examples
3. Hypothesis Patterns
4. Documentation
Example Patterns
# Traditional
def test_specific_case():
assert function(input) == output
# Property-based
@given(st.integers())
def test_idempotent(x):
assert f(f(x)) == f(x)
# Parametrized
@pytest.mark.parametrize("input,expected", [
(1, 1), (2, 4), (3, 9)
])
def test_cases(input, expected):
assert function(input) == expected
Pattern Coverage Matrix
| Pattern |
Use Case |
Example |
| Unit test |
Known input/output |
login with valid credentials |
| Property test |
Mathematical properties |
reversing twice = original |
| Parametrized |
Multiple similar cases |
boundary values |
| Fixture |
Shared setup |
database connection |
| Integration |
End-to-end workflow |
complete user journey |
Success Criteria
Dependencies
Estimated Effort: 2-3 hours
Summary
Provide a reference test template that demonstrates best practices for AI agents to follow when writing tests.
Goal
AI agents need concrete examples of:
Tasks
1. Create Template File
tests/test_template.py2. Test Pattern Examples
3. Hypothesis Patterns
4. Documentation
Example Patterns
Pattern Coverage Matrix
Success Criteria
Dependencies
Estimated Effort: 2-3 hours