Test the goals file's section reader and the round-title breach's wording in process

This commit is contained in:
2026-11-13 03:17:12 +01:00
parent d029f9a1ee
commit 5331a34000
2 changed files with 19 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import unittest
from failure import Failure
from release_plan.goals_file import section
GOALS_FILE = "# P\n## Goals\n1. g\n## Audience\nme\n"
class Section(unittest.TestCase):
def test_gives_the_text_under_the_one_heading(self):
self.assertEqual(section(GOALS_FILE, "Goals"), "1. g")
self.assertEqual(section(GOALS_FILE, "Audience"), "me")
def test_says_what_the_goals_file_lacks(self):
self.assertEqual(section(GOALS_FILE, "Method"), Failure("has no ## Method heading"))
self.assertEqual(section(GOALS_FILE + "## Audience\nyou\n", "Audience"), Failure("has ## Audience more than once"))
self.assertEqual(section("## Goals\n\n## Audience\nme\n", "Goals"), Failure("has no text under ## Goals"))
+2
View File
@@ -111,6 +111,8 @@ class CommandBreaches(unittest.TestCase):
def test_a_round_title_without_its_counts_breaks_round_title_counts(self):
self.assertEqual(checked("git commit -m 'Answer stability round 1: fix the parser'"), ["round-title-counts"])
self.assertEqual(checked("git commit -m 'Answer stability round 1: 1 🔴, 2 🟡; fix the parser'"), ["round-title-counts"])
command = "git commit -m 'Answer stability round 1: fix the parser'"
self.assertEqual(command_breaches(command, simple_commands(command, "/r", "/h"), "/h"), [Breach("round-title-counts", "open the summary after the round's colon with `<k> 🔴, <m> 🟡 (<j> misread);`, where <j> is at most <k> + <m>", "/r")])
self.assertEqual(checked("git commit --allow-empty -m 'Answer prose round 2: 0 🔴, 0 🟡 (0 misread)'"), [])
self.assertEqual(checked("git commit -m 'Answer stability round 1: 1 🔴, 2 🟡 (1 misread); fix the parser'"), [])
self.assertEqual(checked("git commit -m 'Answer the question in the README'"), [])