Skip to content

Commit c91b453

Browse files
committed
Add another unit test to check both conditions
1 parent 22ef750 commit c91b453

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

pydra/engine/tests/test_specs.py

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,15 +374,52 @@ def test_input_file_hash_5(tmpdir):
374374

375375

376376

377-
def test_task_inputs_mandatory_with_xOR():
377+
def test_task_inputs_mandatory_with_xOR_TF():
378378
"""input spec with mandatory inputs"""
379379
input_fields=[
380380
(
381381
"input_1",
382382
bool,
383383
{
384384
"help_string": "help",
385-
"argstr": "--i1",
385+
"mandatory": True,
386+
"xor": ("input_1", "input_2"),
387+
}
388+
),
389+
(
390+
"input_2",
391+
bool,
392+
{
393+
"help_string": "help",
394+
"mandatory": True,
395+
"argstr": "--i2",
396+
"xor": ("input_1", "input_2"),
397+
}
398+
)
399+
]
400+
task_input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,))
401+
task_output_fields = []
402+
task_output_spec = SpecInfo(name="Output", fields=task_output_fields, bases=(ShellOutSpec,))
403+
404+
class MyTask(ShellCommandTask):
405+
input_spec = task_input_spec
406+
output_spec = task_output_spec
407+
executable = "cmd"
408+
409+
task = MyTask()
410+
task.inputs.input_1 = True
411+
task.inputs.input_2 = attr.NOTHING
412+
task.inputs.check_fields_input_spec()
413+
414+
def test_task_inputs_mandatory_with_xOR_TT():
415+
"""input spec with mandatory inputs"""
416+
input_fields=[
417+
(
418+
"input_1",
419+
bool,
420+
{
421+
"help_string": "help",
422+
"mandatory": True,
386423
"xor": ("input_1", "input_2"),
387424
}
388425
),
@@ -404,10 +441,9 @@ def test_task_inputs_mandatory_with_xOR():
404441
class MyTask(ShellCommandTask):
405442
input_spec = task_input_spec
406443
output_spec = task_output_spec
407-
executable = "task"
444+
executable = "cmd"
408445

409446
task = MyTask()
410447
task.inputs.input_1 = True
411448
task.inputs.input_2 = True
412449
task.inputs.check_fields_input_spec()
413-
#task.cmdline

0 commit comments

Comments
 (0)