Answer stability round 1: 0 🔴, 2 🟡 (0 misread); keep the comment in the fake plan, and name move among the writes Jira may have taken
This commit is contained in:
@@ -4,7 +4,6 @@ import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import unittest.mock
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent))
|
||||
|
||||
@@ -14,8 +13,9 @@ from project_config.settings import DEFAULT_FLOOR
|
||||
from todo_item import edits, main
|
||||
from failure import Failure
|
||||
from project_config.main import located
|
||||
from plan_store.fakes import MemoryPlan
|
||||
from release_plan import plan_file, ranking
|
||||
from plan_store.stores import plan_of, Written
|
||||
from plan_store.stores import plan_of
|
||||
from todo_item.table import table
|
||||
|
||||
ADD = ["add", "--release", "0.1.0", "--l", "1", "--e", "1", "--i", "1", "--s", "1", "--moves", "1 by 9", "Count the `a | b` runs."]
|
||||
@@ -419,11 +419,11 @@ class Edit(TodoItem):
|
||||
self.assertEqual(self.run_main("edit", "3", "--comment", "Why.")[::2], (1, "not edited: no flag names a change; todo-item --help lists them\n"))
|
||||
|
||||
def test_an_edit_hands_the_comment_to_the_plan(self):
|
||||
for argv, comment in ((["--comment", "A small change."], "A small change."), ([], None)):
|
||||
for argv, comments in ((["--comment", "A small change."], {3: ["A small change."]}), ([], {})):
|
||||
with self.subTest(argv=argv):
|
||||
plan = unittest.mock.Mock(label="the plan", edit=unittest.mock.Mock(return_value=Written(3)))
|
||||
self.assertEqual(main.edit(main.parser().parse_args(["edit", "3", "--l", "3", *argv]), plan, ""), "Edited item 3 in the plan.")
|
||||
plan.edit.assert_called_once_with(3, {"L": "3"}, None, comment)
|
||||
plan = MemoryPlan({3: {"Release": "0.1.0", "Item": "**Count the runs.**", "L": "1", "E": "2", "I": "3", "S": "1"}})
|
||||
self.assertEqual(main.edit(main.parser().parse_args(["edit", "3", "--l", "3", *argv]), plan, ""), "Edited item 3 in the plan in memory.")
|
||||
self.assertEqual((plan.rows[3]["L"], plan.comments), ("3", comments))
|
||||
|
||||
def test_a_plan_in_a_file_takes_an_edit_with_a_comment_and_keeps_no_comment(self):
|
||||
self.assertEqual(self.run_main("edit", "3", "--l", "3", "--comment", "A small change.")[:2], (0, f"Edited item 3 in {self.todo}.\n"))
|
||||
|
||||
Reference in New Issue
Block a user