mutation.score_markdown(report)
The surviving mutants and the mutation score, as Markdown.
Parameters
| report |
ScoreReport |
The result of mutation_score. |
required |
Returns
| str |
str |
A heading, one table row per surviving mutant (the killed ones are only counted) and the line Mutation score: K/N (P %). |
Examples
from spotregen.mutation import (
MutantResult, ScoreReport, generate_mutants, score_markdown,
)
mutants = generate_mutants("def f(x):\n return x + 1\n")
results = (MutantResult(mutants[0], True, "1 failed"),
MutantResult(mutants[1], False, "survived"))
print(score_markdown(ScoreReport("pkg.f", ("t.py",), 1, results)))
# Mutation score: pkg.f
1 evaluations in t.py, 2 mutants.
## Surviving mutants
| mutant | line | operator | original | mutated |
|---|---:|---|---|---|
| M002 | 2 | operator | `x + 1` | `x - 1` |
Mutation score: 1/2 (50 %).