Answer prose round 1: 0 🔴, 2 🟡; reword the votes and surplus docstrings and rename two tests

This commit is contained in:
2026-10-22 02:21:46 +02:00
parent e32accd08c
commit 4b783ac67b
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ VOTES = ("better", "same", "worse")
def votes(seats: list[Seat]) -> dict[str, list[str]] | Failure:
"""Each seat's five votes as written, in DIMENSIONS' order, once the seats, their lines and their places have the shape a votes file takes; what the votes count as is `counted`'s to say."""
"""Each seat's five votes as written, in DIMENSIONS' order. Fails unless the seats come in a votes file's order and each seat's vote line and places have its shape. `counted` decides what the votes count as."""
names = [seat.name for seat in seats]
if names[:2] != list(FIRST_SEATS) or names[2:] not in ([], list(SPLIT_SEATS)):
return Failure(f"a paired ruling's seats are {' and '.join(FIRST_SEATS)}, then, when their overall votes differ, {' and '.join(SPLIT_SEATS)}, in that order; the file has {', '.join(names) or 'none'}")
@@ -36,7 +36,7 @@ def names_a_place(seat: Seat, dimension: str) -> bool:
def surplus(overall: list[str]) -> bool:
"""Whether seats beyond the first two voted though those two agree, which settles the ruling alone."""
"""Whether seats beyond the first two voted, though the first two agree overall: their agreement settles the ruling by itself."""
return len(overall) > 2 and overall[0] == overall[1]
+2 -2
View File
@@ -68,11 +68,11 @@ class Seats(unittest.TestCase):
self.assertIsInstance(votes([Seat("Mid A", said("better"), ["`a.py:3` `f`: Locality: x"]), seats[1]]), Failure)
self.assertEqual(votes(seats), {seat.name: written[seat.name] for seat in seats})
def test_reads_all_four_seats_without_ruling_on_their_votes(self):
def test_reads_the_other_two_seats_even_when_the_first_two_agree_overall(self):
seats = [Seat(name, said(vote), ["Overall: `f.py:1` `f`: x"]) for name, vote in (("Mid A", "worse"), ("Inherited architect", "worse"), ("Maintainability senior", "better"), ("Junior A", "better"))]
self.assertEqual(list(votes(seats)), [seat.name for seat in seats])
def test_finds_more_seats_than_two_once_the_first_two_agree_overall(self):
def test_flags_seats_beyond_the_first_two_when_those_agree_overall(self):
self.assertTrue(surplus(["worse", "worse", "better", "better"]))
self.assertFalse(surplus(["worse", "worse"]))
self.assertFalse(surplus(["worse", "same", "better", "better"]))