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
CI / tests (pull_request) Has been cancelled
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"), [])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user