Hold the reworded goals-file and todo.md failure messages to their exact text

This commit is contained in:
2026-11-13 00:11:52 +01:00
parent c82b528122
commit ad6118d19f
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -159,6 +159,10 @@ class Rank(unittest.TestCase):
self.assertEqual(ranking.readme_goals(README.replace(" 1.", "\t1.")), [("1", "Achieve"), ("2", "Maintain"), ("2.1", "Achieve")])
self.assertEqual(ranking.readme_goals(README.replace("2. **Maintain:** Correct.", "```\n## Goals\n```\n2. Correct.")), [("1", "Achieve"), ("2", None), ("2.1", "Achieve")])
self.assertEqual(ranking.readme_goals(README.replace("2. **Maintain:**", "1. **Maintain:**")), Failure("the goals file's ## Goals numbers 1, 1, 1.1; number each goal by its position"))
self.assertEqual(ranking.parse_weights(["| Goal | W |", "|---|---|"], ["1"]), Failure("the goal weights list no goal, but the goals file's goals are 1; by position they weigh:\n| Goal | W |\n|---|---|\n| 1 | 1.00 |"))
self.assertEqual(ranking.readme_goals("# P\n"), Failure("the goals file has ## Goals 0 times; it needs it once"))
self.assertEqual(ranking.readme_goals("## Goals\n\nFast.\n"), Failure("the goals file's ## Goals has no numbered goal"))
self.assertEqual(ranking.parse_weights(["| Goal | W |", "|---|---|", "| 1 | 0.5 |", "| 3 | 0.5 |"], ["1", "2"]), Failure("the goal weights list 1, 3, but the goals file's goals are 1, 2; by position they weigh:\n| Goal | W |\n|---|---|\n| 1 | 1.00 |\n| 2 | 0.50 |"))
self.assertEqual(ranking.readme_goals("## Goals\n\n1. **Achieve:** A.\n 1. **Achieve:** B.\n\t2. **Achieve:** C.\n"), [("1", "Achieve"), ("1.1", "Achieve"), ("1.2", "Achieve")])
def test_refuses_a_goal_it_cannot_weigh(self):
+2
View File
@@ -35,6 +35,8 @@ class Main(unittest.TestCase):
self.assertEqual(self.run_main(str(todo)), (1, f"{temp}/README.md: not UTF-8\n"))
pathlib.Path(temp, "README.md").unlink()
self.assertEqual(self.run_main(str(todo)), (1, f"{temp}/README.md: not found; rank_todo.py weighs goals from the file the project's config names as goals-and-audience\n"))
todo.unlink()
self.assertEqual(self.run_main(str(todo)), (1, f"{todo}: not found; every project keeps a todo.md, and rank_todo.py --help shows one\n"))
def test_writes_the_ranked_file_yet_fails_on_an_item_under_the_bar(self):
under = "item 2 scores 3.1, under the bar 4; delete it, or mark it with a reason the bar does not apply"