Add per label remark, post correction
This commit is contained in:
1 parent
3abd7873e6
commit
8918d64452
13 files changed
+343
-23
No files matched your search
@@ -7,7 +7,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
from copienator import EvaluationWorkspace, atomic_write_json, configuration
|
||||
from copienator import ExitCode, EvaluationWorkspace, atomic_write_json, configuration
|
||||
from copienator.commands import clean, giving_names
|
||||
|
||||
|
||||
@@ -40,6 +40,26 @@ class ReturnOutputTests(unittest.TestCase):
|
||||
), contextlib.redirect_stdout(io.StringIO()):
|
||||
self.assertEqual(giving_names.run(self.workspace, annotation_dir="BGnot"), 0)
|
||||
|
||||
def test_regeneration_refreshes_copied_named_files_and_removes_obsolete_pdf(self):
|
||||
self.prepare()
|
||||
for suffix in (".jpg", ".pdf"):
|
||||
target = self.destination / ("Student" + suffix)
|
||||
target.unlink()
|
||||
target.write_bytes(b"old copied output")
|
||||
(self.destination / "custom.pdf").write_bytes(b"keep")
|
||||
with patch.multiple(configuration, RETURN_JPEG_ENABLED=True, RETURN_PDF_ENABLED=True):
|
||||
status = giving_names.update_named_return_answers(
|
||||
self.workspace, "BGnot", copy_ids={"01"}, refresh_named=True)
|
||||
self.assertEqual(status, ExitCode.SUCCESS)
|
||||
self.assertEqual((self.destination / "Student.pdf").read_bytes(), b"pdf")
|
||||
self.assertEqual((self.destination / "Student.jpg").read_bytes(), b"jpeg")
|
||||
(self.source / "Concat_F.pdf").unlink()
|
||||
giving_names.update_named_return_answers(
|
||||
self.workspace, "BGnot", copy_ids={"01"}, refresh_named=True)
|
||||
self.assertFalse((self.destination / "Student.pdf").is_symlink())
|
||||
self.assertFalse((self.destination / "Student.pdf").exists())
|
||||
self.assertEqual((self.destination / "custom.pdf").read_bytes(), b"keep")
|
||||
|
||||
def test_all_combinations_and_reenable_preserve_sources_and_scores(self):
|
||||
for jpeg, pdf in itertools.product((True, False), repeat=2):
|
||||
with self.subTest(jpeg=jpeg, pdf=pdf):
|
||||
|
||||
Reference in new issue
Block a user