Answer stability round 2: 0 🔴, 1 🟡 (0 misread); name the plan's file where its table lacks a column, and test the refusal for a file without a table
This commit is contained in:
@@ -39,7 +39,7 @@ def edited(todo: str, id_: int, named: dict[str, str], detail: str | None, label
|
||||
if isinstance(at, Failure):
|
||||
return at
|
||||
if absent := [column for column in named if column not in table.columns]:
|
||||
return Failure(f"todo.md's items table has no {', '.join(absent)} column")
|
||||
return Failure(f"{label}'s items table has no {', '.join(absent)} column")
|
||||
held = cells(lines[at], len(table.columns))
|
||||
details = item_details(todo)
|
||||
if isinstance(held, Failure):
|
||||
|
||||
@@ -100,6 +100,17 @@ class FilePlan(FilePlanContract):
|
||||
(self.folder / "todo.md").write_text("# todo\n")
|
||||
self.assertIsInstance(store.read(), NoItemsTable)
|
||||
|
||||
def test_a_write_to_a_file_without_an_items_table_fails_naming_the_file(self):
|
||||
store = self.new_store()
|
||||
(self.folder / "todo.md").write_text(EMPTY.split("## Items")[0])
|
||||
tableless = Failure(f"{self.folder / 'todo.md'} holds no items table; rank_todo.py --help shows one")
|
||||
self.assertEqual((store.add(FIRST, ""), store.edit(1, {"L": "1"}, None), store.finish(1)), (tableless,) * 3)
|
||||
|
||||
def test_an_edit_of_a_cell_the_table_has_no_column_for_fails_naming_the_file(self):
|
||||
store = self.new_store()
|
||||
(self.folder / "todo.md").write_text("## Items\n\n| ID | Release | Exempt | Item | R | S | C | A | G | Goals | Score |\n|---|---|---|---|---|---|---|---|---|---|---|\n| 3 | 0.2.0 | | **Do the next thing.** | 5 | 2 | 1 | 2 | 3 | 1 | 1.0 |\n")
|
||||
self.assertEqual(store.edit(3, {"L": "1", "E": "2"}, None), Failure(f"{self.folder / 'todo.md'}'s items table has no L, E column"))
|
||||
|
||||
def test_reads_the_releases_marked_renamed(self):
|
||||
store = self.new_store()
|
||||
(self.folder / "todo.md").write_text(EMPTY + "\n## Renamed\n\n- 0.2.1 renamed to 0.3.0\n")
|
||||
|
||||
Reference in New Issue
Block a user