File tree 1 file changed +28
-8
lines changed
1 file changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -430,30 +430,50 @@ def test_no_outputs1():
430
430
"""Test function tasks with no outputs specified by None return type"""
431
431
432
432
@python .define
433
- def TestFunc (a : A ) -> None :
434
- pass
433
+ def TestFunc1 (a : A ) -> None :
434
+ print ( a )
435
435
436
- outputs = TestFunc (a = A (x = 7 ))()
436
+ outputs = TestFunc1 (a = A (x = 7 ))()
437
437
assert not task_fields (outputs )
438
438
439
439
440
440
def test_no_outputs2 ():
441
441
"""Test function tasks with no outputs set explicitly"""
442
442
443
443
@python .define (outputs = [])
444
- def TestFunc (a : A ):
445
- pass
444
+ def TestFunc2 (a : A ):
445
+ print ( a )
446
446
447
- outputs = TestFunc (a = A (x = 7 ))()
447
+ outputs = TestFunc2 (a = A (x = 7 ))()
448
448
assert not task_fields (outputs )
449
449
450
450
451
451
def test_no_outputs_fail ():
452
452
"""Test function tasks with object inputs"""
453
453
454
454
@python .define (outputs = [])
455
- def TestFunc (a : A ):
455
+ def TestFunc3 (a : A ):
456
456
return a
457
457
458
458
with pytest .raises (ValueError , match = "No output fields were specified" ):
459
- TestFunc (a = A (x = 7 ))()
459
+ TestFunc3 (a = A (x = 7 ))()
460
+
461
+
462
+ def test_only_one_output_fail ():
463
+
464
+ @python .define (outputs = ["out1" , "out2" ])
465
+ def TestFunc4 (a : A ):
466
+ return a
467
+
468
+ with pytest .raises (ValueError , match = "Multiple outputs specified" ):
469
+ TestFunc4 (a = A (x = 7 ))()
470
+
471
+
472
+ def test_incorrect_num_outputs_fail ():
473
+
474
+ @python .define (outputs = ["out1" , "out2" ])
475
+ def TestFunc5 (a : A ):
476
+ return a , a , a
477
+
478
+ with pytest .raises (ValueError , match = "Length of the outputs" ):
479
+ TestFunc5 (a = A (x = 7 ))()
You can’t perform that action at this time.
0 commit comments