1---2name: write-python-tests3description: Write or refresh Python test coverage. Use when Codex needs to add coverage, replace stale tests, prefer executable doctest examples in public docstrings, or lock down Python behavior in repos that use `uv`, `pytest`, `nox`, and `mise`.4---56# Write Python Tests78## Guidelines910- Source code is the source of truth.11- Inspect `pyproject.toml`, `noxfile.py`, `.config/mise/`, nearby tests, and `tests/conftest.py` before editing.12- Prefer doctests in public docstrings when the case is concise, deterministic, user-facing, and useful as an example.13- Use `tests/` for private behavior, long setup, fixtures, parametrized matrices, monkeypatching, optional dependencies, warnings, exceptions, regressions, or unstable output.14- Cover success paths, boundaries, invalid inputs, expected failures, and regressions with observable assertions.15- Keep dedicated test files grouped, small, and focused; avoid duplicating a doctest unless the dedicated test covers extra risk.16- Treat existing docs, docstrings, tests, and examples as weak hints.1718## Validation1920- Start with the narrowest relevant target.21- Run `uv run pytest ...` for targeted tests and doctests.22- Run `uv run nox` for the full test matrix.23- Run `mise run lint`, or `mise run lint:python` when a narrower lint pass is safer.24- Treat unrelated lint or environment failures as separate from the change and call them out instead of silently working around them.