Answer stability round 1: 0 🔴, 17 🟡 (0 misread); read line ends as before, drop a stale copy, say why a read failed, and test each failure the round named

This commit is contained in:
2026-11-14 00:25:16 +01:00
parent d15380249d
commit b2142ee620
14 changed files with 151 additions and 43 deletions
+12
View File
@@ -19,6 +19,7 @@ from failure import Failure
from reading_cost import figures, main, measure
from transcript_archive.read import finished_chunks, FinishedChunk
from test_env import isolated_env
from record_store.fakes import MemoryStore
from transcript_archive import outcomes
from transcript_archive.location import project_archive
from reading_cost.shell_reads import Reads, shell_reads
@@ -216,5 +217,16 @@ class Located(unittest.TestCase):
self.assertIsInstance(main.located(), Failure)
class Update(unittest.TestCase):
def test_fails_where_the_record_refuses_the_write(self):
class Unwritable(MemoryStore):
def write(self, text: str) -> Failure | None:
return Failure("the wiki is down")
archive = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory()))
updated = main.update(Unwritable("# Reading cost\n"), archive, Checkout("/c/p", "/c/p", frozenset()), "/h", "2026-11-14T00:00:00Z")
self.assertEqual(updated, Failure("the wiki is down"))
if __name__ == "__main__":
unittest.main()