Answer prose round 1: 0 🔴, 6 🟡 (0 misread); docstrings and a fixture's comment say what the code does
CI / tests (pull_request) Has been cancelled

This commit is contained in:
2026-11-23 22:31:03 +01:00
parent fe6d119183
commit 2aa7b7399a
6 changed files with 20 additions and 15 deletions
+2 -2
View File
@@ -63,7 +63,7 @@ def statuses(results: str) -> dict[str, str]:
class Change(NamedTuple):
"""The source lines a mutant changes: the number of the first, those lines as the source has them, and what the mutant has in their place."""
"""The source lines a mutant changes: the number of the first, those lines as the source has them, and what the mutant has in their place. Where it only adds lines, the number is that of the line they go in before."""
line: int
was: tuple[str, ...]
@@ -73,7 +73,7 @@ class Change(NamedTuple):
def mutated_lines(source: str, copy: str, key: str, number: int) -> Change | None:
"""The source lines a mutant changes; None where the mutants/ copy lacks the mutant, or holds an original unlike the source.
A mutant is a changed copy of the original, so the lines before the first that differs, and those after the last, sit at the same offsets from the source function's def."""
A mutant is a changed copy of the original. The lines before the first that differs sit at the same offsets from the source function's def, and those after the last at the same offsets from its end."""
module, copied = parsed(source), parsed(copy)
if module is None or copied is None:
return None
+8 -6
View File
@@ -1,5 +1,5 @@
"""The bugs task-bench plants in Go: Gremlins' killed mutants, re-applied from its report, and what go test prints of the test
each fails."""
"""The bugs task-bench plants in Go: Gremlins' killed mutants, re-applied from its report, and the message go test prints when a test
fails on one."""
import os
import pathlib
import re
@@ -56,8 +56,8 @@ def go_files(top: str) -> list[str]:
def reapplied(reported: in_diff_tools.Mutant, lines: list[bytes]) -> Mutant | None:
"""The mutant Gremlins reports by its mutator and the token it changed, at a line and a column in bytes, both from 1, as the
line it changes in a file of those lines. None where the place holds no token the mutator changes."""
"""The mutant Gremlins reported, as the line it changes; `lines` are its file's. Gremlins names the mutator and where the token
it changed starts: a line, and a column in bytes, both from 1. None where no token the mutator changes starts there."""
if not (1 <= reported.line <= len(lines) and reported.column >= 1):
return None
line = lines[reported.line - 1]
@@ -73,8 +73,10 @@ def reapplied(reported: in_diff_tools.Mutant, lines: list[bytes]) -> Mutant | No
def task_text(output: str) -> str | None:
"""What Haiku is told of a planted bug: the failing assertion's message in go test's output, without the test's name, file or
line, so it says what goes wrong and not where. That is the last message of the first failed test that printed one, since a
test logs before it asserts; a test with a failed subtest is left out, since it fails with the subtest. None where no failed test printed a message, as on a panic, a build that broke or a passing run,
or where the message only names the test."""
test logs before it asserts. A test with a failed subtest is left out, since it fails with the subtest.
None where no failed test printed a message, as on a panic, a build that broke or a passing run, or where the message only
names the test."""
lines = output.splitlines()
failed = set(FAILED_TEST.findall(output))
# A subtest is named `TestPick/empty_input`; a message may name the whole or the test it belongs to.
+2 -2
View File
@@ -61,7 +61,7 @@ def drawn(mutants: list[Mutant], seed: int) -> list[Mutant]:
def task_text(path: str, output: str, languages: tuple[Language, ...] = LANGUAGES) -> str | None:
"""What Haiku is told of a bug planted in the file at path, one place_files named: the failing test's message in output,
what the test command printed, as the file's language reads it. None where the output holds no such message."""
"""What Haiku is told of a bug planted in the file at path, one place_files named. output is what the test command printed;
the file's language picks the failing test's message out of it. None where it finds none."""
language = language_of(path, languages)
return language.told(output) if language else None
+4 -3
View File
@@ -9,8 +9,9 @@ HUNK = re.compile(r"^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@", re.MULTILINE)
class Mutant(typing.NamedTuple):
"""A mutant the project's tests killed, as the lines it changes in the tree its tool ran in: the number of the first, from 1,
those lines as the tree has them, and what the mutant has in their place. name is what the report calls the bug it becomes:
the path and line, then the tool's own name of the mutant."""
those lines as the tree has them, and what the mutant has in their place. Where it only adds lines, the number is that of the
line they go in before. name is what the report calls the bug it becomes: the path and line, then what the tool tells the
mutant by, which is Gremlins' column and mutator, or mutmut's name."""
path: str
line: int
@@ -20,7 +21,7 @@ class Mutant(typing.NamedTuple):
def mutated(source: bytes, mutant: Mutant) -> bytes | None:
"""A file's source with the mutant applied, or None where its line doesn't start the lines the mutant changes."""
"""A file's source with the mutant applied, or None where the lines the mutant changes don't stand at the mutant's line."""
lines = source.split(b"\n")
first = mutant.line - 1
if not 0 <= first <= len(lines) or tuple(lines[first:first + len(mutant.was)]) != mutant.was:
+2 -2
View File
@@ -1,5 +1,5 @@
"""The bugs task-bench plants in Python: mutmut's killed mutants, re-applied from the copy of each file it writes, and what pytest
prints of the test each fails."""
"""The bugs task-bench plants in Python: mutmut's killed mutants, re-applied from the copy of each file it writes, and the message
pytest prints when a test fails on one."""
import re
from failure import Failure
+2
View File
@@ -35,6 +35,8 @@ class PlaceFilesTest(unittest.TestCase):
def test_names_none_where_the_seats_found_no_places(self):
self.assertEqual(place_files("Seats found no places hard."), [])
def test_names_none_where_the_places_name_only_test_files_or_another_suffix(self):
self.assertEqual(place_files("- `tests/test_geo.py:3` `load`\n- `geo_test.py:3` `load`\n- `notes.pyc:1` `x`\n"), [])