Skip to content

Strengthen qcore.cli.from_docstring tests to kill surviving mutants - #397

Open
ucgmsim[bot] wants to merge 1 commit into
masterfrom
ai/mutants
Open

ucgmsim[bot] wants to merge 1 commit into
masterfrom
ai/mutants

Conversation

@ucgmsim

@ucgmsim ucgmsim Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Adds tests in tests/test_cli.py for qcore.cli.from_docstring. They check the rewritten signature directly: annotations, ArgumentInfo/OptionInfo defaults and help text. They also check the exact help string stored on the registered command, and the runtime behaviour of required arguments and option defaults.

Mutants killed

Mutant Test
_6: drops style=NUMPYDOC, so the style is auto-detected test_from_docstring_forces_numpydoc_style: a docstring with two reST :param: lines and one numpydoc parameter. With auto-detection the reST parse wins because it has more fields, and the numpydoc parameter's help is lost.
_10: short_description or 'XXXX' test_from_docstring_command_help_no_summary: the command help must be ""
_11, _12: long_description and '' / or 'XXXX' test_from_docstring_command_help_short_only: the help must be exactly "Summary only."
_19, _21, _22: missing-param help defaults to None / "XXXX" test_from_docstring_implicit_signature: undocumented params have help == ""
_23, _24, _25, _26: param_type logic test_from_docstring_implicit_signature: an annotated param keeps its annotation (int/float), and an unannotated param gets str
_32: isinstance(...) or not m.help test_from_docstring_keeps_explicit_annotated_help: explicit help= in Annotated metadata is not overwritten by the docstring
_44, _46: Argument annotation None / not replaced test_from_docstring_implicit_signature (int and str annotations on arguments)
_47: typer.Argument(None, ...) test_from_docstring_implicit_signature (default.default is ...), and test_from_docstring_implicit_runtime_behaviour (calling with no arguments fails)
_53, _55: Option annotation None / not replaced test_from_docstring_implicit_signature (float and str annotations on options)
_56: typer.Option(None, ...) test_from_docstring_implicit_signature (default.default == 1.5), and test_from_docstring_implicit_runtime_behaviour (the default 1.5 is used)

Equivalent mutants

  • _49: typer.Argument(..., help=...) → typer.Argument(help=...). This makes no difference because the default parameter of typer.Argument is already ..., so both calls build the same ArgumentInfo.

I could not run mutmut locally. Each kill above is based on reading the code; the CI mutation run will confirm it. .ai/ci-checks passes (ruff, ruff-format, deptry, npdlint, ty, pytest).

Surviving mutants in qcore/cli.py: 19 → 1.

Cost $0.57, 21 turns.

🤖 Generated with Claude Code

Adds tests in `tests/test_cli.py` for `qcore.cli.from_docstring`. They check the rewritten signature directly: annotations, `ArgumentInfo`/`OptionInfo` defaults and help text. They also check the exact help string stored on the registered command, and the runtime behaviour of required arguments and option defaults.

## Mutants killed

| Mutant | Test |
|---|---|
| `_6`: drops `style=NUMPYDOC`, so the style is auto-detected | `test_from_docstring_forces_numpydoc_style`: a docstring with two reST `:param:` lines and one numpydoc parameter. With auto-detection the reST parse wins because it has more fields, and the numpydoc parameter's help is lost. |
| `_10`: `short_description or 'XXXX'` | `test_from_docstring_command_help_no_summary`: the command help must be `""` |
| `_11`, `_12`: `long_description and ''` / `or 'XXXX'` | `test_from_docstring_command_help_short_only`: the help must be exactly `"Summary only."` |
| `_19`, `_21`, `_22`: missing-param help defaults to `None` / `"XXXX"` | `test_from_docstring_implicit_signature`: undocumented params have `help == ""` |
| `_23`, `_24`, `_25`, `_26`: `param_type` logic | `test_from_docstring_implicit_signature`: an annotated param keeps its annotation (`int`/`float`), and an unannotated param gets `str` |
| `_32`: `isinstance(...) or not m.help` | `test_from_docstring_keeps_explicit_annotated_help`: explicit `help=` in `Annotated` metadata is not overwritten by the docstring |
| `_44`, `_46`: Argument annotation `None` / not replaced | `test_from_docstring_implicit_signature` (`int` and `str` annotations on arguments) |
| `_47`: `typer.Argument(None, ...)` | `test_from_docstring_implicit_signature` (`default.default is ...`), and `test_from_docstring_implicit_runtime_behaviour` (calling with no arguments fails) |
| `_53`, `_55`: Option annotation `None` / not replaced | `test_from_docstring_implicit_signature` (`float` and `str` annotations on options) |
| `_56`: `typer.Option(None, ...)` | `test_from_docstring_implicit_signature` (`default.default == 1.5`), and `test_from_docstring_implicit_runtime_behaviour` (the default `1.5` is used) |

## Equivalent mutants

- `_49`: `typer.Argument(..., help=...)` → `typer.Argument(help=...)`. This makes no difference because the `default` parameter of `typer.Argument` is already `...`, so both calls build the same `ArgumentInfo`.

I could not run mutmut locally. Each kill above is based on reading the code; the CI mutation run will confirm it. `.ai/ci-checks` passes (ruff, ruff-format, deptry, npdlint, ty, pytest).

Surviving mutants in `qcore/cli.py`: 19 → 1.

_Cost $0.57, 21 turns._

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ucgmsim ucgmsim Bot added ai-generated Opened by the scheduled Claude jobs ai-tests Bot-written tests (coverage or mutation) that need review labels Oct 6, 2026
@ucgmsim
ucgmsim Bot requested a review from lispandfound October 6, 2026 12:42

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Opened by the scheduled Claude jobs ai-tests Bot-written tests (coverage or mutation) that need review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant