Repository navigation
Strengthen qcore.cli.from_docstring tests to kill surviving mutants - #397
Open
ucgmsim[bot] wants to merge 1 commit into
Open
ucgmsim[bot] wants to merge 1 commit into
ucgmsim[bot] wants to merge 1 commit into
Conversation
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>
lispandfound
approved these changes
Oct 6, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds tests in
tests/test_cli.pyforqcore.cli.from_docstring. They check the rewritten signature directly: annotations,ArgumentInfo/OptionInfodefaults 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
_6: dropsstyle=NUMPYDOC, so the style is auto-detectedtest_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 toNone/"XXXX"test_from_docstring_implicit_signature: undocumented params havehelp == ""_23,_24,_25,_26:param_typelogictest_from_docstring_implicit_signature: an annotated param keeps its annotation (int/float), and an unannotated param getsstr_32:isinstance(...) or not m.helptest_from_docstring_keeps_explicit_annotated_help: explicithelp=inAnnotatedmetadata is not overwritten by the docstring_44,_46: Argument annotationNone/ not replacedtest_from_docstring_implicit_signature(intandstrannotations on arguments)_47:typer.Argument(None, ...)test_from_docstring_implicit_signature(default.default is ...), andtest_from_docstring_implicit_runtime_behaviour(calling with no arguments fails)_53,_55: Option annotationNone/ not replacedtest_from_docstring_implicit_signature(floatandstrannotations on options)_56:typer.Option(None, ...)test_from_docstring_implicit_signature(default.default == 1.5), andtest_from_docstring_implicit_runtime_behaviour(the default1.5is used)Equivalent mutants
_49:typer.Argument(..., help=...)→typer.Argument(help=...). This makes no difference because thedefaultparameter oftyper.Argumentis already..., so both calls build the sameArgumentInfo.I could not run mutmut locally. Each kill above is based on reading the code; the CI mutation run will confirm it.
.ai/ci-checkspasses (ruff, ruff-format, deptry, npdlint, ty, pytest).Surviving mutants in
qcore/cli.py: 19 → 1.Cost $0.57, 21 turns.
🤖 Generated with Claude Code