measures.measures_table

measures.measures_table(spec, score=None)

Intent coverage and specification size of every unit, as a Markdown table.

Parameters

Name Type Description Default
spec RegenSpec The loaded spec. required
score Mapping[str, tuple[int, int]] | None Mutation score per unit (dotted module name), as (killed, planted) from spotregen.mutation.mutation_score. If given, the table gains a last column mutation score; a unit without an entry shows -. Defaults to None: no column, and nothing is run. None

Returns

Name Type Description
str str One row per unit, ordered by name, and a total row. coverage is covered items out of all items; spec is the sum of unit, decisions and evaluations; ratio is spec per line of code; mutation score is killed out of planted mutants.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen import load_spec, make_sample_repo, measures_table

with TemporaryDirectory() as tmp:
    spec = load_spec(make_sample_repo(Path(tmp) / "demo"))
    print(measures_table(spec))
    print(measures_table(spec, {"samplepkg.core.calc": (2, 4)}))
| unit | coverage | code | unit | decisions | evaluations | spec | ratio |
|---|---:|---:|---:|---:|---:|---:|---:|
| samplepkg.core.calc | 1/1 | 10 | 26 | 9 | 9 | 44 | 4.4 |
| unit | coverage | code | unit | decisions | evaluations | spec | ratio | mutation score |
|---|---:|---:|---:|---:|---:|---:|---:|---:|
| samplepkg.core.calc | 1/1 | 10 | 26 | 9 | 9 | 44 | 4.4 | 2/4 |