Answer stability round 1: 0 🔴, 2 🟡 (0 misread); score the person's issue in the contract test, and hold scores, moves and exempt apart from blockers
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
"""What every backend of an epic's plan must hold, as tests. A backend's test case inherits EpicStoreContract and unittest.TestCase, and builds an epic with no issues in new_store. Its assign, close, person_files, score and block change the tracker as a person, or the plan store, would."""
|
||||
"""What every backend of an epic's plan must hold, as tests. A backend's test case inherits EpicStoreContract and unittest.TestCase, and builds an epic with no issues in new_store. Its assign, close, person_files, score and block change the tracker as a person or the plan store would."""
|
||||
import re
|
||||
import typing
|
||||
|
||||
from do_epic.backend.protocol import EpicIssue, EpicStore
|
||||
from failure import Failure
|
||||
from plan.todo_table import ItemFields
|
||||
|
||||
|
||||
class EpicStoreContract:
|
||||
@@ -27,8 +26,8 @@ class EpicStoreContract:
|
||||
"""Files a child issue of the epic as a person does in the tracker, not through the store, and answers its key."""
|
||||
raise NotImplementedError
|
||||
|
||||
def score(self, store: EpicStore, key: str, scores: dict[str, str]) -> None:
|
||||
"""Sets the scores of the issue named key, as `plan_store` writes them: each column's name with its value as text, such as {"L": "2", "Moves": "1 by 5"}."""
|
||||
def score(self, store: EpicStore, key: str, scores: dict[str, object]) -> None:
|
||||
"""Sets the scores of the issue named key as `plan_store` writes them: each column's name with its value, a whole number for a score and text for Moves and Exempt, such as {"L": 2, "Moves": "1 by 5"}."""
|
||||
raise NotImplementedError
|
||||
|
||||
def block(self, store: EpicStore, key: str, blocker: str) -> None:
|
||||
@@ -125,15 +124,14 @@ class EpicStoreContract:
|
||||
store = self.new_store()
|
||||
key = self.filed(store, store.epic_key, "Count the runs.")
|
||||
[issue] = self.issues(store)
|
||||
self.assertEqual((issue.key, issue.scores, issue.blockers), (key, ItemFields(), ()))
|
||||
self.assertEqual((issue.key, issue.scores, issue.moves, issue.exempt, issue.blockers), (key, {}, (), "", ()))
|
||||
|
||||
def test_reads_the_scores_a_person_or_the_plan_store_set(self) -> None:
|
||||
store = self.new_store()
|
||||
key = self.filed(store, store.epic_key, "Count the runs.")
|
||||
self.score(store, key, {"L": "2", "E": "3", "I": "4", "S": "3", "Moves": "1 by 5", "Exempt": "security"})
|
||||
self.score(store, key, {"L": 2, "E": 3, "I": 4, "S": 3, "Moves": "1 by 5", "Exempt": "security"})
|
||||
[issue] = self.issues(store)
|
||||
self.assertEqual((issue.scores.scores, issue.scores.moves, issue.scores.exempt), ({"L": 2, "E": 3, "I": 4, "S": 3}, (("1", 5),), "security"))
|
||||
self.assertEqual((issue.scores.release, issue.scores.blocked_by), (None, ()))
|
||||
self.assertEqual((issue.scores, issue.moves, issue.exempt), ({"L": 2, "E": 3, "I": 4, "S": 3}, (("1", 5),), "security"))
|
||||
|
||||
def test_reads_each_blocker_of_an_issue_and_none_for_a_blocker_of_another(self) -> None:
|
||||
store = self.new_store()
|
||||
@@ -147,6 +145,8 @@ class EpicStoreContract:
|
||||
store = self.new_store()
|
||||
ours = self.filed(store, store.epic_key, "Count the runs.")
|
||||
theirs = self.person_files(store, "A person's issue.")
|
||||
# The plan store scores an issue a person filed without making it the loop's.
|
||||
self.score(store, theirs, {"L": 2, "E": 3, "I": 4, "S": 3, "Moves": "1 by 5"})
|
||||
task = self.filed(store, ours, "Count them in the api.")
|
||||
read = {issue.key: issue for issue in self.issues(store)}
|
||||
self.assertEqual([read[key].by_loop for key in (ours, theirs, task)], [True, False, True])
|
||||
|
||||
Reference in New Issue
Block a user