Answer architecture round 1: 0 🔴, 2 🟡 (0 misread); read a round title's counts once, into one Counts value

This commit is contained in:
2026-10-23 11:30:17 +02:00
parent 4d18b8e125
commit 80cc36e904
4 changed files with 50 additions and 47 deletions
+10 -14
View File
@@ -4,7 +4,7 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from round_titles import lacks_counts, past_cap, round_counts, round_findings, round_misreads
from round_titles import Counts, lacks_counts, past_cap, round_counts, round_findings
class Rounds(unittest.TestCase):
@@ -32,7 +32,7 @@ class Cap(unittest.TestCase):
class RoundFindings(unittest.TestCase):
def test_sums_the_counts_each_round_title_opens_with(self):
self.assertEqual(round_findings(["Answer stability round 1: 1 🔴, 2 🟡; flag a deleted test", "Answer prose round 1: 0 🔴, 3 🟡", "Merge origin/main"]), (1, 5))
self.assertEqual(round_findings(["Answer stability round 1: 1 🔴, 2 🟡; flag a deleted test", "Answer prose round 1: 0 🔴, 3 🟡", "Merge origin/main"]), Counts(1, 5, None))
def test_knows_no_count_when_a_round_title_or_every_round_lacks_one(self):
self.assertIsNone(round_findings(["Answer stability round 1: 1 🔴, 2 🟡; fix", "Answer prose round 1: fix the README"]))
@@ -40,7 +40,14 @@ class RoundFindings(unittest.TestCase):
self.assertIsNone(round_findings(["Do the work"]))
def test_reads_the_counts_of_a_title_that_also_counts_misread_findings(self):
self.assertEqual(round_findings(["Answer stability round 1: 1 🔴, 2 🟡 (1 misread); fix", "Answer prose round 1: 0 🔴, 3 🟡 (0 misread)"]), (1, 5))
self.assertEqual(round_findings(["Answer stability round 1: 1 🔴, 2 🟡 (1 misread); fix", "Answer prose round 1: 0 🔴, 3 🟡 (0 misread)"]), Counts(1, 5, 1))
def test_sums_the_misread_findings_each_round_title_counts(self):
self.assertEqual(round_findings(["Answer stability round 1: 1 🔴, 2 🟡 (1 misread); fix", "Answer prose round 1: 0 🔴, 3 🟡 (2 misread)", "Merge origin/main"]), Counts(1, 5, 3))
self.assertEqual(round_findings(["Answer stability round 1: 0 🔴, 0 🟡 (0 misread)"]), Counts(0, 0, 0))
def test_knows_no_misread_count_when_a_round_title_lacks_one(self):
self.assertEqual(round_findings(["Answer stability round 1: 1 🔴, 2 🟡 (1 misread); fix", "Answer prose round 1: 0 🔴, 3 🟡; fix"]), Counts(1, 5, None))
def test_finds_a_round_title_without_counts(self):
@@ -51,16 +58,5 @@ class RoundFindings(unittest.TestCase):
self.assertFalse(lacks_counts("Answer the question"))
class RoundMisreads(unittest.TestCase):
def test_sums_the_misread_findings_each_round_title_counts(self):
self.assertEqual(round_misreads(["Answer stability round 1: 1 🔴, 2 🟡 (1 misread); fix", "Answer prose round 1: 0 🔴, 3 🟡 (2 misread)", "Merge origin/main"]), 3)
self.assertEqual(round_misreads(["Answer stability round 1: 0 🔴, 0 🟡 (0 misread)"]), 0)
def test_knows_no_count_when_a_round_title_or_every_round_lacks_one(self):
self.assertIsNone(round_misreads(["Answer stability round 1: 1 🔴, 2 🟡 (1 misread); fix", "Answer prose round 1: 0 🔴, 3 🟡; fix"]))
self.assertIsNone(round_misreads(["Answer stability round 1: fix"]))
self.assertIsNone(round_misreads(["Do the work"]))
if __name__ == "__main__":
unittest.main()