Skip to main content

mutation.score_toml

mutation.score_toml(report)

The full result as TOML, one [[mutant]] table per mutant, for archiving.

Parameters

Name Type Description Default
report ScoreReport The result of mutation_score. required

Returns

Name Type Description
str str TOML text that starts with format = 1 and has unit, module (relative to the root), module_sha256 (of the module the mutants were made from), babregen_version, base (the full SHA), dirty, python, pytest, packages_sha256, timeout_s, evaluations, baseline_passed, planted, killed and the mutants (each with end_line and diff besides id, line, operator, original, mutated, killed and detail).

Examples

import tomllib

from babregen.mutation import (
    MutantResult, ScoreReport, generate_mutants, score_toml,
)

mutants = generate_mutants("X = 1\n")
results = (MutantResult(mutants[0], True, "1 failed"),)
facts = ("0" * 40, False, "3.14.0", "9.0.0", "0" * 64, 120.0)
report = ScoreReport("pkg.x", "src/pkg/x.py", "0" * 64, ("t.py",), 1, results, *facts)
print(tomllib.loads(score_toml(report))["killed"])
1