Kill the mutants of the judge run archive that its tests missed
This commit is contained in:
@@ -62,6 +62,26 @@ class JudgeRuns(unittest.TestCase):
|
||||
self.assertEqual(outcomes.judge_run_at(kept, utc(NOW + 1)), self.judged.file)
|
||||
self.assertIsNone(outcomes.judge_run_at(kept, utc(NOW + 2)))
|
||||
|
||||
def test_keeps_a_run_as_readable_utf_8_json_indented_by_one_space(self):
|
||||
run = JudgeRun("Prompt é.", {"a": 1})
|
||||
self.assertEqual(run.content(), b'{\n "prompt": "Prompt \xc3\xa9.",\n "reply": {\n "a": 1\n }\n}')
|
||||
|
||||
def test_names_the_run_on_each_kind_of_outcome_that_has_a_judge(self):
|
||||
named = f"Judge: j\nJudge run: {self.judged.file}\n"
|
||||
kept = [
|
||||
outcomes.unfinished("w", "e", "j", "", judge_run=self.judged),
|
||||
outcomes.interrupted("Q?", "e", "j", "", "w", judge_run=self.judged),
|
||||
outcomes.answered(question="Q?", sources="S", answer="a", evidence="e", escalation="", judge="j", worker="w", judge_run=self.judged),
|
||||
]
|
||||
self.assertEqual([named in outcome for outcome in kept], [True, True, True])
|
||||
|
||||
def test_names_the_folder_it_cannot_make_in_the_failure_to_keep_a_run(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
(pathlib.Path(root) / "judge").write_text("a file where the folder should be")
|
||||
failure = write.keep_judge_run(pathlib.Path(root), self.judged)
|
||||
self.assertRegex(failure.reason, f"^could not archive the transcript: {root}/judge: ")
|
||||
self.assertNotIn("None", failure.reason)
|
||||
|
||||
def test_writes_no_outcome_where_the_run_cannot_be_kept(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
kept = pathlib.Path(root, "archive")
|
||||
|
||||
Reference in New Issue
Block a user