Write unit tests for an existing module
Usage description
Increase coverage with meaningful tests for normal and edge cases.
Prompt text
Write unit tests for {{extra}} in {{project}} using {{stack}}.
- Read the code first and write a list of the behaviours to test.
- Cover: the normal case, boundaries, invalid input and expected errors.
- Use mocks only for external boundaries (network, time, database).
- Test names that describe the behaviour.
- Run the tests and show me the result and the actual line coverage.
- If you find a bug in the code while testing, tell me, and do not change the test so it passes.Required inputs
The module and the test framework.
Expected outputs
A test file, the run result and the coverage.
Suitable tools
Practical example
stack = "pytest", extra = "utils/dates.py".
We do not claim this prompt was tested on a particular model; results vary with the model and context, so always review the output.
