Answer principles round 1: 0 🔴, 5 🟡 (0 misread); make a move a union with ToStatus, take only parsed events in figures, catch OSError at each file operation, pass progress through the bench, type the sides, and split the README bullet
CI / tests (pull_request) Successful in 5m4s
CI / tests (pull_request) Successful in 5m4s
This commit is contained in:
@@ -9,6 +9,7 @@ from failure import Failure
|
||||
from mutate_changes.in_diff_tools import gremlins_mutants
|
||||
from mutate_changes.changed_lines import is_test
|
||||
from mutate_changes.tool_process import Run
|
||||
from task_bench.figures import Side
|
||||
|
||||
# A place as `larv-review places` prints it: `<path>:<line>` in backticks.
|
||||
PLACE = re.compile(r"`([^`\s:]+):\d+`")
|
||||
@@ -86,7 +87,7 @@ def mutated(source: bytes, mutant: Mutant) -> bytes | None:
|
||||
return b"\n".join(lines)
|
||||
|
||||
|
||||
def bug_at_sides(mutant: Mutant, diff: str, sources: dict[str, bytes | None]) -> dict[str, bytes] | None:
|
||||
def bug_at_sides(mutant: Mutant, diff: str, sources: dict[Side, bytes | None]) -> dict[Side, bytes] | None:
|
||||
"""The file of mutant with the bug in it, at the base and at the head, from the file at each side, None where the side has
|
||||
none, and the diff of it from base to head. None where the mutant doesn't become a bug at one side or the other.
|
||||
|
||||
@@ -94,8 +95,9 @@ def bug_at_sides(mutant: Mutant, diff: str, sources: dict[str, bytes | None]) ->
|
||||
at_head = line_at_head(diff, mutant.line)
|
||||
if at_head is None:
|
||||
return None
|
||||
bugs = {}
|
||||
for side, placed in (("base", mutant), ("head", mutant._replace(line=at_head))):
|
||||
bugs: dict[Side, bytes] = {}
|
||||
placings: tuple[tuple[Side, Mutant], ...] = (("base", mutant), ("head", mutant._replace(line=at_head)))
|
||||
for side, placed in placings:
|
||||
changed = None if (source := sources[side]) is None else mutated(source, placed)
|
||||
if changed is None:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user