@@ -17,3 +17,158 @@ def test_conditional_step_no_inputs() -> None:
1717 stderr = re .sub (r"\s\s+" , " " , stderr )
1818 assert err_code == 0 , stderr
1919 assert result is None
20+
21+
22+ def test_conditional_scatter_missing_input () -> None :
23+ """Test that scattering a missing array skips execution."""
24+ err_code , stdout , stderr = get_main_output (
25+ [
26+ get_data ("tests/wf/scatter_before_when.cwl" ),
27+ ]
28+ )
29+ result = json .loads (stdout )["optional_echoed_messages" ]
30+ stderr = re .sub (r"\s\s+" , " " , stderr )
31+ assert err_code == 0 , stderr
32+ assert result == []
33+
34+
35+ def test_scatter_empty_array () -> None :
36+ """Test that scattering an empty array skips execution."""
37+ err_code , stdout , stderr = get_main_output (
38+ [
39+ get_data ("tests/wf/scatter_before_when.cwl" ),
40+ get_data ("tests/wf/scatter_before_when-inp_empty.yaml" ),
41+ ]
42+ )
43+ result = json .loads (stdout )["optional_echoed_messages" ]
44+ stderr = re .sub (r"\s\s+" , " " , stderr )
45+ assert err_code == 0 , stderr
46+ assert result == []
47+
48+
49+ def test_scatter_and_conditional () -> None :
50+ """Test scattering a partially empty array with a conditional."""
51+ err_code , stdout , stderr = get_main_output (
52+ [
53+ get_data ("tests/wf/scatter_before_when.cwl" ),
54+ get_data ("tests/wf/scatter_before_when-inp.yaml" ),
55+ ]
56+ )
57+ result = json .loads (stdout )["optional_echoed_messages" ]
58+ stderr = re .sub (r"\s\s+" , " " , stderr )
59+ assert err_code == 0 , stderr
60+ assert result == ["We\n " , "come\n " , "in\n " , "peace\n " ]
61+
62+
63+ def test_scatter_dotproduct_empty_arrays () -> None :
64+ """Test that dotproduct scattering empty arrays skips execution."""
65+ err_code , stdout , stderr = get_main_output (
66+ [
67+ get_data ("tests/wf/scatter_before_when_dotproduct.cwl" ),
68+ ]
69+ )
70+ result = json .loads (stdout )["optional_echoed_messages" ]
71+ stderr = re .sub (r"\s\s+" , " " , stderr )
72+ assert err_code == 0 , stderr
73+ assert result == []
74+
75+
76+ def test_scatter_dotproduct_and_conditional () -> None :
77+ """Test dotproduct scattering with partially empty arrays."""
78+ err_code , stdout , stderr = get_main_output (
79+ [
80+ get_data ("tests/wf/scatter_before_when_dotproduct.cwl" ),
81+ get_data ("tests/wf/scatter_before_when_dotproduct-inp.yaml" ),
82+ ]
83+ )
84+ result = json .loads (stdout )["optional_echoed_messages" ]
85+ stderr = re .sub (r"\s\s+" , " " , stderr )
86+ assert err_code == 0 , stderr
87+ assert result == [
88+ "We Never\n " ,
89+ "Come Out\n " ,
90+ "In Anything But\n " ,
91+ "Peace -- The Aliens\n " ,
92+ ]
93+
94+
95+ def test_scatter_nested_crossproduct_empty_arrays () -> None :
96+ """Test that nested_dotproduct scattering empty arrays skips execution."""
97+ err_code , stdout , stderr = get_main_output (
98+ [
99+ get_data ("tests/wf/scatter_before_when-nested_crossproduct.cwl" ),
100+ ]
101+ )
102+ result = json .loads (stdout )["optional_echoed_messages" ]
103+ stderr = re .sub (r"\s\s+" , " " , stderr )
104+ assert err_code == 0 , stderr
105+ assert result == []
106+
107+
108+ def test_scatter_nested_crossproduct_and_conditional () -> None :
109+ """Test nested_crossproduct scattering with partially empty arrays."""
110+ err_code , stdout , stderr = get_main_output (
111+ [
112+ get_data ("tests/wf/scatter_before_when-nested_crossproduct.cwl" ),
113+ get_data ("tests/wf/scatter_before_when_dotproduct-inp.yaml" ),
114+ ]
115+ )
116+ result = json .loads (stdout )["optional_echoed_messages" ]
117+ stderr = re .sub (r"\s\s+" , " " , stderr )
118+ assert err_code == 0 , stderr
119+ assert result == [
120+ ["We Never\n " , "We Out\n " , "We Anything But\n " , None , "We -- The Aliens\n " ],
121+ [
122+ "Come Never\n " ,
123+ "Come Out\n " ,
124+ "Come Anything But\n " ,
125+ None ,
126+ "Come -- The Aliens\n " ,
127+ ],
128+ ["In Never\n " , "In Out\n " , "In Anything But\n " , None , "In -- The Aliens\n " ],
129+ [None , None , None , None , None ],
130+ ]
131+
132+
133+ def test_scatter_flat_crossproduct_empty_arrays () -> None :
134+ """Test that flat_dotproduct scattering empty arrays skips execution."""
135+ err_code , stdout , stderr = get_main_output (
136+ [
137+ get_data ("tests/wf/scatter_before_when-flat_crossproduct.cwl" ),
138+ ]
139+ )
140+ result = json .loads (stdout )["optional_echoed_messages" ]
141+ stderr = re .sub (r"\s\s+" , " " , stderr )
142+ assert err_code == 0 , stderr
143+ assert result == []
144+
145+
146+ def test_scatter_flat_crossproduct_and_conditional () -> None :
147+ """Test flat_crossproduct scattering with partially empty arrays."""
148+ err_code , stdout , stderr = get_main_output (
149+ [
150+ get_data ("tests/wf/scatter_before_when-flat_crossproduct.cwl" ),
151+ get_data ("tests/wf/scatter_before_when_dotproduct-inp.yaml" ),
152+ ]
153+ )
154+ result = json .loads (stdout )["optional_echoed_messages" ]
155+ stderr = re .sub (r"\s\s+" , " " , stderr )
156+ assert err_code == 0 , stderr
157+ assert result == [
158+ "We Never\n " ,
159+ "We Out\n " ,
160+ "We Anything But\n " ,
161+ "We -- The Aliens\n " ,
162+ "Come Never\n " ,
163+ "Come Out\n " ,
164+ "Come Anything But\n " ,
165+ "Come -- The Aliens\n " ,
166+ "In Never\n " ,
167+ "In Out\n " ,
168+ "In Anything But\n " ,
169+ "In -- The Aliens\n " ,
170+ "Peace Never\n " ,
171+ "Peace Out\n " ,
172+ "Peace Anything But\n " ,
173+ "Peace -- The Aliens\n " ,
174+ ]
0 commit comments