Answer stability round 3: 0 🔴, 1 🟡; test that security outranks a higher-scoring defect
This commit is contained in:
@@ -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):
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ def parse_moves(id_: str, cell: str) -> Moves | Failure:
|
||||
if repeated := [goal for goal in goals if goals.count(goal) > 1]:
|
||||
return Failure(f"item {id_} cites goal {repeated[0]} twice; name each goal once")
|
||||
if nested := [(parent, goal) for parent in goals for goal in goals if goal.startswith(parent + ".")]:
|
||||
return Failure(f"item {id_} names goal {nested[0][0]} beside its sub-goal {nested[0][1]}; name only the most specific goal an item moves, and a parent only for a move none of its sub-goals covers")
|
||||
return Failure(f"item {id_} names goal {nested[0][0]} and its sub-goal {nested[0][1]}; name one, never both: the sub-goal where the move serves it, else the parent")
|
||||
return moves
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user