Remove `Arguments supplémentaires' boxes
This commit is contained in:
+116
-1
@@ -1674,12 +1674,37 @@ class WorkflowTests(unittest.TestCase):
|
||||
if step.skip_without_manual_conflicts
|
||||
}
|
||||
|
||||
self.assertEqual(auto_start, {"splitting", "grouping"})
|
||||
self.assertEqual(
|
||||
auto_start,
|
||||
{"crop_blank_margins", "splitting", "crop_exercise_bottoms", "grouping"},
|
||||
)
|
||||
self.assertEqual(
|
||||
skip_for_live, {"submit_batches", "batch_status", "fetch_batches"}
|
||||
)
|
||||
self.assertEqual(skip_without_conflicts, {"manual_resolution"})
|
||||
|
||||
def test_crop_auto_start_follows_always_crop_configuration(self) -> None:
|
||||
for enabled in (False, True):
|
||||
with self.subTest(enabled=enabled), patch(
|
||||
"copienator_gui.workflow.ALWAYS_CROP", enabled
|
||||
):
|
||||
steps = {step.id: step for step in build_workflow(False)}
|
||||
self.assertEqual(
|
||||
steps["crop_blank_margins"].auto_start_first_visit, enabled
|
||||
)
|
||||
self.assertEqual(
|
||||
steps["crop_exercise_bottoms"].auto_start_first_visit, enabled
|
||||
)
|
||||
self.assertTrue(steps["crop_blank_margins"].optional)
|
||||
self.assertTrue(steps["crop_exercise_bottoms"].optional)
|
||||
|
||||
def test_default_and_repository_crop_configuration(self) -> None:
|
||||
import config
|
||||
import default_config
|
||||
|
||||
self.assertFalse(default_config.ALWAYS_CROP)
|
||||
self.assertTrue(config.ALWAYS_CROP)
|
||||
|
||||
def test_review_persp_has_shorter_title(self) -> None:
|
||||
self.assertEqual(self.steps["review_persp"].title, "Relire les barèmes")
|
||||
|
||||
@@ -1790,6 +1815,82 @@ class WorkflowTests(unittest.TestCase):
|
||||
command_arguments(command), [self.evaluation, "--batch-from", "Ex 4"]
|
||||
)
|
||||
|
||||
def test_only_multi_target_steps_offer_free_form_arguments(self) -> None:
|
||||
documented = {
|
||||
step.id: step
|
||||
for step in self.steps.values()
|
||||
if step.extra_arguments_help
|
||||
}
|
||||
self.assertEqual(set(documented), {"labels", "correction"})
|
||||
self.assertIn("Cutleft", documented["labels"].extra_arguments_help)
|
||||
self.assertIn("Group_X.jpg", documented["correction"].extra_arguments_help)
|
||||
self.assertEqual(
|
||||
documented["correction"].extra_arguments_variants,
|
||||
("live", "batch", "hybrid", "refaire"),
|
||||
)
|
||||
|
||||
def test_options_previously_requiring_free_form_arguments_have_controls(self) -> None:
|
||||
status = self.command(
|
||||
"batch_status",
|
||||
"default",
|
||||
{"download": "files/job-1", "output": "/tmp/result.jsonl"},
|
||||
)
|
||||
self.assertEqual(
|
||||
command_arguments(status),
|
||||
["--download", "files/job-1", "--output", "/tmp/result.jsonl"],
|
||||
)
|
||||
|
||||
grouped = self.command(
|
||||
"read_annotations",
|
||||
"grouped",
|
||||
{
|
||||
"target": self.evaluation,
|
||||
"refaire": True,
|
||||
"annotation_dir": "Bnot",
|
||||
},
|
||||
)
|
||||
self.assertEqual(
|
||||
command_arguments(grouped),
|
||||
[self.evaluation, "--refaire", "--annotation-dir", "Bnot"],
|
||||
)
|
||||
|
||||
def test_verbose_is_added_only_to_commands_that_support_it(self) -> None:
|
||||
labels = self.steps["labels"]
|
||||
labels_command = build_command(
|
||||
REPOSITORY,
|
||||
labels,
|
||||
labels.variants[0],
|
||||
{"target": self.evaluation},
|
||||
self.evaluation,
|
||||
verbose=True,
|
||||
)
|
||||
self.assertEqual(command_arguments(labels_command), [self.evaluation, "--verbose"])
|
||||
|
||||
rotate = self.steps["rotate"]
|
||||
rotate_command = build_command(
|
||||
REPOSITORY,
|
||||
rotate,
|
||||
rotate.variants[0],
|
||||
{"target": self.evaluation},
|
||||
self.evaluation,
|
||||
verbose=True,
|
||||
)
|
||||
self.assertEqual(
|
||||
command_arguments(rotate_command),
|
||||
["rotate", self.evaluation, "--verbose"],
|
||||
)
|
||||
|
||||
update = self.steps["update_ods"]
|
||||
update_command = build_command(
|
||||
REPOSITORY,
|
||||
update,
|
||||
update.variants[0],
|
||||
{"target": self.evaluation},
|
||||
self.evaluation,
|
||||
verbose=True,
|
||||
)
|
||||
self.assertNotIn("--verbose", update_command)
|
||||
|
||||
def test_annotation_variants_are_exclusive_commands(self) -> None:
|
||||
command = self.command(
|
||||
"annotation", "grouped", {"target": self.evaluation, "overwrite": True}
|
||||
@@ -1815,6 +1916,20 @@ class WorkflowTests(unittest.TestCase):
|
||||
),
|
||||
[self.evaluation, "--yes"],
|
||||
)
|
||||
preview = next(variant for variant in clean.variants if variant.id == "dry_run")
|
||||
self.assertFalse(preview.dangerous)
|
||||
self.assertEqual(
|
||||
command_arguments(
|
||||
build_command(
|
||||
REPOSITORY,
|
||||
clean,
|
||||
preview,
|
||||
{"target": self.evaluation},
|
||||
self.evaluation,
|
||||
)
|
||||
),
|
||||
[self.evaluation, "--dry-run"],
|
||||
)
|
||||
|
||||
|
||||
class CrossPlatformFileTests(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user