Answer architecture round 2: fail a place naming no dimension, keep a ratchet until a ruling follows, leave the base on a fall-called run, let record-scoring say whether the floor blocks, and name the missing dimension in a discounted vote
This commit is contained in:
+18
-9
@@ -48,14 +48,16 @@ class Seats(unittest.TestCase):
|
||||
self.assertIsInstance(report(""), Failure)
|
||||
|
||||
def test_counts_each_vote_of_a_seat_naming_no_place_as_same(self):
|
||||
seats = [Seat("Mid A", said("worse", "worse"), ["the whole skill"]), Seat("Inherited architect", said("better"), ["`a.py:3` `f`: shorter"])]
|
||||
seats = [Seat("Mid A", said("worse", "worse"), ["Locality: the whole skill"]), Seat("Inherited architect", said("better"), ["`a.py:3` `f`: Overall: shorter"])]
|
||||
written = votes(seats)
|
||||
self.assertEqual(written, {"Mid A": ["same", "worse", "same", "same", "worse"], "Inherited architect": ["same", "same", "same", "same", "better"]})
|
||||
self.assertEqual(counted(seats, written)["Mid A"], ["same"] * 5)
|
||||
|
||||
def test_counts_a_dimensions_vote_only_where_a_place_names_that_dimension(self):
|
||||
seats = [Seat("Mid A", said("better", "worse"), ["`a.py:3` `f`: shorter"]), Seat("Inherited architect", said("better", "worse"), ["`a.py:3` `f`: locality, held at once"])]
|
||||
self.assertEqual([votes[1:] for votes in counted(seats, {seat.name: [*said("better", "worse").replace(",", "").split()[1::2]] for seat in seats}).values()], [["same", "same", "same", "better"], ["worse", "same", "same", "better"]])
|
||||
seats = [Seat("Mid A", said("better", "worse"), ["`a.py:3` `f`: Shape, reshaped"]), Seat("Inherited architect", said("better", "worse"), ["`a.py:3` `f`: Locality, held at once"])]
|
||||
written = {seat.name: ["same", "worse", "same", "same", "better"] for seat in seats}
|
||||
self.assertEqual(counted(seats, written), {"Mid A": ["same", "same", "same", "same", "better"], "Inherited architect": written["Inherited architect"]})
|
||||
self.assertIsInstance(votes([Seat("Mid A", said("better"), ["`a.py:3` `f`: self sufficiency"]), seats[1]]), Failure)
|
||||
|
||||
def test_refuses_two_more_seats_once_the_first_two_agree_overall(self):
|
||||
seats = [Seat(name, said(vote), ["`f.py:1` `f`: x"]) for name, vote in (("Mid A", "worse"), ("Inherited architect", "worse"), ("Maintainability senior", "better"), ("Junior A", "better"))]
|
||||
@@ -117,12 +119,11 @@ class History(unittest.TestCase):
|
||||
history = appended(appended("", SCORING), ruled)
|
||||
self.assertTrue(history.startswith("# Comprehension history\n\n## 2026-10-08T12:00:00Z"))
|
||||
self.assertNotIn("Inherited architect, decided by:", history)
|
||||
self.assertIn("| Inherited architect | same | same (voted worse, naming no place) | same | same | same (voted worse, naming no place) |", history)
|
||||
self.assertIn("| Inherited architect | same | same (voted worse, no place naming Locality) | same | same | same (voted worse, naming no place) |", history)
|
||||
found = entries(history)
|
||||
self.assertEqual([(entry.commit, entry.against, entry.ruling, entry.fell) for entry in found], [("aaaaaaa", None, None, []), ("bbbbbbb", "aaaaaaa", "better", ["Locality"])])
|
||||
self.assertEqual(found[1].places, [Place("bin/a.py", "f"), Place("bin/a.py", "g")])
|
||||
self.assertEqual([entry.paired for entry in found], [False, True])
|
||||
self.assertNotIn("Fell:", ruling_entry("2026-10-08T18:37:21Z, PR #2 at bbbbbbb, against aaaaaaa", seats, written, written, "worse", ["Locality"]))
|
||||
|
||||
|
||||
class PendingFall(unittest.TestCase):
|
||||
@@ -276,7 +277,7 @@ class LarvReviewTool(unittest.TestCase):
|
||||
|
||||
Mid A: {worse}
|
||||
|
||||
- `bin/a.py:3` `f`: three branches
|
||||
- `bin/a.py:3` `f`: Overall: three branches
|
||||
|
||||
Inherited architect: {same}
|
||||
"""
|
||||
@@ -286,7 +287,7 @@ class LarvReviewTool(unittest.TestCase):
|
||||
self.assertTrue(split.stdout.startswith("Split: Mid A worse, Inherited architect same."))
|
||||
history = self.checkout / "docs" / "comprehension-history.md"
|
||||
self.assertFalse(history.exists())
|
||||
lines += f"\n\t\t\tMaintainability senior: {said('worse')}\n\n\t\t\t- `bin/a.py:3` `f`: hard\n\n\t\t\tJunior A: {said('worse')}\n"
|
||||
lines += f"\n\t\t\tMaintainability senior: {said('worse')}\n\n\t\t\t- `bin/a.py:3` `f`: Overall: hard\n\n\t\t\tJunior A: {said('worse')}\n"
|
||||
ran = self.run_tool("record-ruling", self.seats_file(lines))
|
||||
self.assertEqual(ran.stdout.splitlines()[0], "Ruling: same. Overall votes as counted: Mid A worse, Inherited architect same, Maintainability senior worse, Junior A same (voted worse, naming no place).")
|
||||
recorded = entries(history.read_text())
|
||||
@@ -312,16 +313,24 @@ class LarvReviewTool(unittest.TestCase):
|
||||
stands = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats.replace("Locality 6.5", "Locality 7")))
|
||||
self.assertIn("The paired ruling stands: Locality fell and stays at or above the floor of 7.0.", stands.stdout)
|
||||
|
||||
def test_names_no_fall_on_a_worse_ruling(self):
|
||||
place = "\n\n- `bin/a.py:3` `f`: Locality, longer\n\n"
|
||||
ran = self.run_tool("record-ruling", self.seats_file(f"PR #2 at {self.start}, against {self.start}\n\nMid A: {said('worse', 'worse')}{place}Inherited architect: {said('worse', 'worse')}{place}"))
|
||||
self.assertEqual(ran.returncode, 0, ran.stderr)
|
||||
self.assertNotIn("Fell:", ran.stdout + (self.checkout / "docs" / "comprehension-history.md").read_text())
|
||||
|
||||
def test_records_a_scoring_run_with_its_means(self):
|
||||
line = "Navigation 7, Locality 6.5, Shape 7, Self-sufficiency 6.5, Overall 7"
|
||||
seats = "".join(f"\n{seat}: {line}\n\n- `bin/a.py:3` `f`: long\n" for seat in ("Junior A", "Mid A", "Maintainability senior", "Inherited architect"))
|
||||
ran = self.run_tool("record-scoring", self.seats_file(f"PR #2 at {self.start}\n" + seats))
|
||||
self.assertEqual(ran.returncode, 0, ran.stderr)
|
||||
self.assertIn("Under the floor of 7.0: Locality 6.50, Self-sufficiency 6.50.", ran.stdout)
|
||||
self.assertIn("Under the floor of 7.0, blocking nothing on a run due for no reason besides a fall: Locality 6.50, Self-sufficiency 6.50.", ran.stdout)
|
||||
due = self.run_tool("record-scoring", self.seats_file(f"PR #3 at {self.start}\n" + seats), "1")
|
||||
self.assertIn("Floor: Locality 6.50, Self-sufficiency 6.50 under the floor of 7.0 block the merge, as the chunk leaves release 0.1.0 with no plan item.", due.stdout)
|
||||
text = (self.checkout / "docs" / "comprehension-history.md").read_text()
|
||||
self.assertIn("| Mean | 7.00 | 6.50 | 7.00 | 6.50 | 7.00 |", text)
|
||||
self.assertIn("Inherited architect, would restructure first:", text)
|
||||
self.assertEqual([entry.places for entry in entries(text)], [[Place("bin/a.py", "f")] * 4])
|
||||
self.assertEqual(entries(text)[0].places, [Place("bin/a.py", "f")] * 4)
|
||||
|
||||
def test_refuses_a_ruling_file_that_names_no_base_or_a_commit_the_checkout_lacks(self):
|
||||
ran = self.run_tool("record-ruling", self.seats_file(f"PR #2 at {self.start}\n\nMid A: {said('same')}\n\nInherited architect: {said('same')}\n"))
|
||||
|
||||
Reference in New Issue
Block a user