@@ -380,7 +380,7 @@ class SimpleTask(ShellCommandTask):
380
380
{
381
381
"help_string" : "help" ,
382
382
"mandatory" : True ,
383
- "xor" : ("input_1" , "input_2" ),
383
+ "xor" : ("input_1" , "input_2" , "input_3" ),
384
384
}
385
385
),
386
386
(
@@ -390,9 +390,18 @@ class SimpleTask(ShellCommandTask):
390
390
"help_string" : "help" ,
391
391
"mandatory" : True ,
392
392
"argstr" : "--i2" ,
393
- "xor" : ("input_1" , "input_2" ),
393
+ "xor" : ("input_1" , "input_2" , "input_3" ),
394
394
}
395
- )
395
+ ),
396
+ (
397
+ "input_3" ,
398
+ bool ,
399
+ {
400
+ "help_string" : "help" ,
401
+ "mandatory" : True ,
402
+ "xor" : ("input_1" , "input_2" , "input_3" ),
403
+ }
404
+ )
396
405
]
397
406
task_input_spec = SpecInfo (name = "Input" , fields = input_fields , bases = (ShellSpec ,))
398
407
task_output_fields = []
@@ -410,13 +419,24 @@ def test_task_inputs_mandatory_with_xOR_one_mandatory_is_OK():
410
419
task .inputs .input_2 = attr .NOTHING
411
420
task .inputs .check_fields_input_spec ()
412
421
413
- def test_task_inputs_mandatory_with_xOR_zero_mandatory_raises_error ():
422
+ def test_task_inputs_mandatory_with_xOR_one_mandatory_out_3_is_OK ():
414
423
"""input spec with mandatory inputs"""
415
424
task = SimpleTask ()
416
425
task .inputs .input_1 = attr .NOTHING
417
426
task .inputs .input_2 = attr .NOTHING
427
+ task .inputs .input_3 = True
418
428
task .inputs .check_fields_input_spec ()
419
429
430
+ def test_task_inputs_mandatory_with_xOR_zero_mandatory_raises_error ():
431
+ """input spec with mandatory inputs"""
432
+ task = SimpleTask ()
433
+ task .inputs .input_1 = attr .NOTHING
434
+ task .inputs .input_2 = attr .NOTHING
435
+ with pytest .raises (Exception ) as excinfo :
436
+ task .inputs .check_fields_input_spec ()
437
+ assert "input_1 is mandatory, but no value provided" in str (excinfo .value )
438
+ assert excinfo .type is AttributeError
439
+
420
440
421
441
def test_task_inputs_mandatory_with_xOR_two_mandatories_raises_error ():
422
442
"""input spec with mandatory inputs"""
@@ -426,5 +446,17 @@ def test_task_inputs_mandatory_with_xOR_two_mandatories_raises_error():
426
446
427
447
with pytest .raises (Exception ) as excinfo :
428
448
task .inputs .check_fields_input_spec ()
429
- assert "input_2 is mutually exclusive with ('input_1', 'input_2')" in str (excinfo .value )
449
+ assert "input_2 is mutually exclusive with ('input_1', 'input_2'" in str (excinfo .value )
450
+ assert excinfo .type is AttributeError
451
+
452
+ def test_task_inputs_mandatory_with_xOR_3_mandatories_raises_error ():
453
+ """input spec with mandatory inputs"""
454
+ task = SimpleTask ()
455
+ task .inputs .input_1 = 'Input1'
456
+ task .inputs .input_2 = True
457
+ task .inputs .input_3 = False
458
+
459
+ with pytest .raises (Exception ) as excinfo :
460
+ task .inputs .check_fields_input_spec ()
461
+ assert "input_2 is mutually exclusive with ('input_1', 'input_2', 'input_3'" in str (excinfo .value )
430
462
assert excinfo .type is AttributeError
0 commit comments