Answer stability round 3: 0 🔴, 1 🟡; test that security outranks a higher-scoring defect

This commit is contained in:
2026-10-16 03:29:41 +02:00
parent c2697c6281
commit eee8d534a5
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -156,13 +156,15 @@ class Rank(unittest.TestCase):
self.assertEqual(self.ranked(todo, readme), Failure(reason))
def test_ranks_defects_after_security_and_before_the_rest(self):
rows = [line.split(" | ")[0] for line in self.ranked(TODO.replace("| 2 | 0.1.0 | | |", "| 2 | 0.1.0 | | defect |")).text.splitlines() if line.startswith("| ") and " | 0." in line]
# Item 4, security, scores under the defect, so only the order of the groups puts it first.
todo = TODO.replace("| 2 | 0.1.0 | | |", "| 2 | 0.1.0 | | defect |").replace("| 9 | 2 | 3 | 2.1 by 1 |", "| 9 | 8 | 3 | 2.1 by 1 |")
rows = [line.split(" | ")[0] for line in self.ranked(todo).text.splitlines() if line.startswith("| ") and " | 0." in line]
self.assertEqual(rows, ["| 4", "| 2", "| 3", "| 5", "| 1"])
def test_refuses_a_goal_named_beside_its_own_sub_goal(self):
readme = "## Goals\n\n1. **Achieve:** A.\n 1. **Maintain:** B.\n 2. **Achieve:** C.\n2. **Achieve:** D.\n"
todo = TODO.replace("2.1 by 8, 1 by 6", "1.2 by 2, 1 by 3").replace("| 2.1 by 1 |", "| 2 by 1 |")
self.assertEqual(self.ranked(todo, readme), Failure("item 3 names goal 1 beside its sub-goal 1.2; name only the most specific goal an item moves, and a parent only for a move none of its sub-goals covers"))
self.assertEqual(self.ranked(todo, readme), Failure("item 3 names goal 1 and its sub-goal 1.2; name one, never both: the sub-goal where the move serves it, else the parent"))
self.assertIsInstance(self.ranked(todo.replace("1.2 by 2, 1 by 3", "1.2 by 2, 2 by 3"), readme), rank_todo.Ranked)
def test_scores_every_item_zero_where_readme_marks_no_goal_achieve(self):