mutation.Mutant

mutation.Mutant(id, line, operator, original, mutated, source)

One planted change of a module.

Attributes

Name Type Description
id str M001, M002, … in source order.
line int Line of the changed node in the original module.
operator str compare, boolean, negation, condition, constant, operator, statement, raise or return.
original str The changed expression or statement before the change.
mutated str The same after the change.
source str The whole mutated module.

Examples

from spotregen.mutation import generate_mutants

mutant = generate_mutants("def f(x):\n    return x < 1\n")[0]
print(mutant.id, mutant.line, mutant.operator, mutant.original, "->", mutant.mutated)
M001 2 return return x < 1 -> return None