Rank question items first in their release, then security, as lilleman asked

This commit is contained in:
2026-10-16 03:50:42 +02:00
parent d8338e71ed
commit 02f4a698b5
7 changed files with 28 additions and 25 deletions
+4 -4
View File
@@ -155,10 +155,10 @@ class Rank(unittest.TestCase):
with self.subTest(reason=reason):
self.assertEqual(self.ranked(todo, readme), Failure(reason))
def test_ranks_security_first_whatever_it_scores_and_a_defect_by_its_score(self):
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", "| 3", "| 2", "| 5", "| 1"])
def test_ranks_questions_first_then_security_whatever_they_score_and_a_defect_by_its_score(self):
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 |").replace("| 5 | 0.1.0 | | decision |", "| 5 | 0.1.0 | | question |")
rows = [line.split(" | ")[0] for line in self.ranked(todo, decisions="").text.splitlines() if line.startswith("| ") and " | 0." in line]
self.assertEqual(rows, ["| 5", "| 4", "| 3", "| 2", "| 1"])
def test_weighs_the_maintain_goal_a_defect_restores_as_the_heaviest_achieve_goal(self):
ranked = self.ranked(TODO.replace("| 2 | 0.1.0 | | | **Tighten the tests.** | 2 | 4 | 3 | 2.1 by 1 |", "| 2 | 0.1.0 | | defect | **Tighten the tests.** | 2 | 4 | 3 | 2 by 3 |"))