@@ -528,29 +528,13 @@ def InputAccessWorkflow(a, b, c):
528
528
def test_workflow_lzout_inputs2 (tmp_path : Path ):
529
529
530
530
@workflow .define
531
- def InputAccessWorkflow (a , b , c ):
531
+ def InputAccessWorkflow2 (a , b , c ):
532
532
add = workflow .add (Add (a = a , b = b ))
533
533
add .inputs .a = c
534
534
mul = workflow .add (Mul (a = add .out , b = b ))
535
535
return mul .out
536
536
537
- input_access_workflow = InputAccessWorkflow (a = 1 , b = 2.0 , c = 3.0 )
538
- outputs = input_access_workflow (cache_root = tmp_path )
539
- assert outputs .out == 10.0
540
-
541
-
542
- def test_workflow_lzout_inputs2 (tmp_path : Path ):
543
- """Set the inputs of the 'add' node after its outputs have been accessed
544
- but the state has not been altered"""
545
-
546
- @workflow .define
547
- def InputAccessWorkflow (a , b , c ):
548
- add = workflow .add (Add (a = a , b = b ))
549
- mul = workflow .add (Mul (a = add .out , b = b ))
550
- add .inputs .a = c
551
- return mul .out
552
-
553
- input_access_workflow = InputAccessWorkflow (a = 1 , b = 2.0 , c = 3.0 )
537
+ input_access_workflow = InputAccessWorkflow2 (a = 1 , b = 2.0 , c = 3.0 )
554
538
outputs = input_access_workflow (cache_root = tmp_path )
555
539
assert outputs .out == 10.0
556
540
@@ -561,15 +545,14 @@ def test_workflow_lzout_inputs_state_change_fail(tmp_path: Path):
561
545
This changes the type of the input and is therefore not permitted"""
562
546
563
547
@workflow .define
564
- def InputAccessWorkflow (a , b , c ):
548
+ def InputAccessWorkflow3 (a , b , c ):
565
549
add1 = workflow .add (Add (a = a , b = b ), name = "add1" )
566
550
add2 = workflow .add (Add (a = a ).split (b = c ), name = "add2" )
567
551
mul1 = workflow .add (Mul (a = add1 .out , b = b ), name = "mul1" )
568
- mul2 = workflow .add (Mul (a = mul1 .out , b = b ), name = "mul2" )
552
+ workflow .add (Mul (a = mul1 .out , b = b ), name = "mul2" )
569
553
mul1 .inputs .a = add2 .out
570
- return mul2 .out
571
554
572
- input_access_workflow = InputAccessWorkflow (a = 1 , b = 2.0 , c = [3.0 , 4.0 ])
555
+ input_access_workflow = InputAccessWorkflow3 (a = 1 , b = 2.0 , c = [3.0 , 4.0 ])
573
556
with pytest .raises (
574
557
RuntimeError , match = "have already been accessed and therefore cannot set"
575
558
):
0 commit comments