Recorrection GUI step ; LaTeX issues debugging

This commit is contained in:
sebastien committed 2026-10-10 20:40:48 +02:00
1 parent 2d0f7a219f
commit 48602c24f1
12 files changed
+306 -8

No files matched your search

+62
View File
@@ -214,6 +214,49 @@ class GuiConvenienceTests(unittest.TestCase):
self.assertNotIn("overwrite", self.app.arg_vars)
self.assertIn("--refaire", self.app._make_command())
def test_optional_recorrection_opens_examples_and_returns_to_correction(self):
from copienator import read_json
ids = [step.id for step in self.app.steps]
self.assertEqual(ids[ids.index("manual_resolution") + 1], "prepare_recorrection")
copies = self.evaluation / "Copies"
copies.mkdir()
(copies / "Copie46.pdf").touch()
(self.evaluation / "labels").write_text("II)9)\n")
self.app.tree.selection_set("prepare_recorrection")
self.app.update()
with patch("copienator_gui.app.open_path") as opened:
self.app.edit_recorrection_button.invoke()
path = self.evaluation / "refaire.json"
opened.assert_called_once_with(path)
self.assertEqual(read_json(path), [])
path.write_text(path.read_text().replace("\n[]\n", '\n[["Copie46", []]]\n'))
with patch.object(self.app.runner, "start") as start:
self.app.run_button.invoke()
self.app.update()
start.assert_not_called()
self.assertEqual(self.app.state_store.step("prepare_recorrection")["status"], "success")
self.assertEqual(self.app.current_step.id, "correction")
self.assertEqual(self.app.variant_var.get(), "refaire")
self.assertIn("--refaire", self.app._make_command())
self.assertNotIn("--overwrite", self.app._make_command())
def test_ignoring_optional_recorrection_continues_without_creating_file(self):
self.app.tree.selection_set("prepare_recorrection")
self.app.update()
self.app._skip_step()
self.app.update()
self.assertEqual(self.app.current_step.id, "post_correction")
self.assertEqual(self.app.state_store.step("prepare_recorrection")["status"], "skipped")
self.assertFalse((self.evaluation / "refaire.json").exists())
def test_optional_recorrection_requires_a_saved_selection(self):
self.app.tree.selection_set("prepare_recorrection")
self.app.update()
with patch("copienator_gui.app.messagebox.showerror") as error:
self.app.run_button.invoke()
error.assert_called_once()
self.assertEqual(self.app.current_step.id, "prepare_recorrection")
def test_giving_names_waits_for_explicit_manual_completion(self):
return_dir = self.evaluation / "A Rendre" / "Student (01)"
return_dir.mkdir(parents=True)
@@ -560,6 +603,25 @@ class GuiConvenienceTests(unittest.TestCase):
self.assertIn("Cibler la copie sélectionnée", controls)
self.assertIn("Cibler tout le dossier", controls)
def test_answer_splitting_waits_for_target_and_can_select_one_copy(self):
copies = self.evaluation / "Copies"
copies.mkdir()
for name in ("Copie01.pdf", "Copie46.pdf"):
(copies / name).touch()
with patch.object(self.app, "_run_current_step") as run:
self.app.tree.selection_set("splitting")
self.app.update()
run.assert_not_called()
self.assertIn("Copie46.pdf", self.app.copy_paths)
self.app.copy_var.set("Copie46.pdf")
self.app._target_selected_copy()
command = self.app._make_command()
self.assertIn("split-answers", command)
self.assertEqual(Path(command[5]), copies / "Copie46.pdf")
self.app._target_all_pages()
command = self.app._make_command()
self.assertEqual((self.repository / command[5]).resolve(), self.evaluation)
def test_label_review_can_show_and_target_one_copy(self):
copies = self.evaluation / "Copies"
copies.mkdir()