43
43
)
44
44
assert _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW
45
45
46
- _DUPLICATE_WORKFLOW_VARIABLE_NAMES_WORKFLOW_FILE : str = os .path .join (
47
- os .path .dirname (__file__ ),
48
- "workflow-definitions" ,
49
- "duplicate-workflow-variable-names.yaml" ,
50
- )
51
- with open (
52
- _DUPLICATE_WORKFLOW_VARIABLE_NAMES_WORKFLOW_FILE , "r" , encoding = "utf8"
53
- ) as workflow_file :
54
- _DUPLICATE_WORKFLOW_VARIABLE_NAMES_WORKFLOW : Dict [str , Any ] = yaml .safe_load (
55
- workflow_file
56
- )
57
- assert _DUPLICATE_WORKFLOW_VARIABLE_NAMES_WORKFLOW
58
-
59
46
_SIMPLE_PYTHON_PARALLEL_FILE : str = os .path .join (
60
47
os .path .dirname (__file__ ),
61
48
"workflow-definitions" ,
78
65
)
79
66
assert _STEP_SPECIFICATION_VARIABLE_NAMES_WORKFLOW
80
67
81
- _WORKFLOW_OPTIONS_WORKFLOW_FILE : str = os .path .join (
82
- os .path .dirname (__file__ ),
83
- "workflow-definitions" ,
84
- "workflow-options.yaml" ,
85
- )
86
- with open (_WORKFLOW_OPTIONS_WORKFLOW_FILE , "r" , encoding = "utf8" ) as workflow_file :
87
- _WORKFLOW_OPTIONS : Dict [str , Any ] = yaml .safe_load (workflow_file )
88
- assert _WORKFLOW_OPTIONS
89
-
90
68
91
69
def test_validate_schema_for_minimal ():
92
70
# Arrange
@@ -144,7 +122,7 @@ def test_validate_schema_for_shortcut_example_1():
144
122
assert error is None
145
123
146
124
147
- def test_validate_schema_for_python_simple_molprops ():
125
+ def test_validate_schema_for_simple_python_molprops ():
148
126
# Arrange
149
127
150
128
# Act
@@ -164,16 +142,7 @@ def test_validate_schema_for_step_specification_variable_names():
164
142
assert error is None
165
143
166
144
167
- def test_validate_schema_for_workflow_options ():
168
- # Arrange
169
-
170
- # Act
171
- error = decoder .validate_schema (_WORKFLOW_OPTIONS )
172
-
173
- # Assert
174
- assert error is None
175
-
176
-
145
+ @pytest .mark .skip (reason = "DO not support combination atm" )
177
146
def test_validate_schema_for_simple_python_parallel ():
178
147
# Arrange
179
148
@@ -188,7 +157,7 @@ def test_get_workflow_variables_for_smiple_python_molprops():
188
157
# Arrange
189
158
190
159
# Act
191
- wf_variables = decoder .get_variable_names (_SIMPLE_PYTHON_MOLPROPS_WORKFLOW )
160
+ wf_variables = decoder .get_workflow_variable_names (_SIMPLE_PYTHON_MOLPROPS_WORKFLOW )
192
161
193
162
# Assert
194
163
assert len (wf_variables ) == 2
@@ -228,91 +197,6 @@ def test_get_workflow_steps():
228
197
assert steps [1 ]["name" ] == "step2"
229
198
230
199
231
- def test_get_workflow_variables_for_duplicate_variables ():
232
- # Arrange
233
-
234
- # Act
235
- names = decoder .get_variable_names (_DUPLICATE_WORKFLOW_VARIABLE_NAMES_WORKFLOW )
236
-
237
- # Assert
238
- assert len (names ) == 2
239
- assert names [0 ] == "x"
240
- assert names [1 ] == "x"
241
-
242
-
243
- def test_get_required_variable_names_for_simnple_python_molprops_with_options ():
244
- # Arrange
245
-
246
- # Act
247
- rqd_variables = decoder .get_required_variable_names (
248
- _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW
249
- )
250
-
251
- # Assert
252
- assert len (rqd_variables ) == 2
253
- assert "candidateMolecules" in rqd_variables
254
- assert "rdkitPropertyValue" in rqd_variables
255
-
256
-
257
- def test_set_variables_from_options_for_step_for_simnple_python_molprops_with_options ():
258
- # Arrange
259
- variables = {
260
- "rdkitPropertyName" : "propertyName" ,
261
- "rdkitPropertyValue" : "propertyValue" ,
262
- }
263
-
264
- # Act
265
- new_variables = decoder .set_variables_from_options_for_step (
266
- _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW ,
267
- variables ,
268
- "step1" ,
269
- )
270
-
271
- # Assert
272
- assert len (new_variables ) == 2
273
- assert "name" in new_variables
274
- assert "value" in new_variables
275
- assert new_variables ["name" ] == "propertyName"
276
- assert new_variables ["value" ] == "propertyValue"
277
-
278
-
279
- def test_get_workflow_inputs_for_step_with_name_step1 ():
280
- # Arrange
281
-
282
- # Act
283
- inputs = decoder .get_workflow_job_input_names_for_step (
284
- _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW , "step1"
285
- )
286
-
287
- # Assert
288
- assert len (inputs ) == 1
289
- assert "inputFile" in inputs
290
-
291
-
292
- def test_get_workflow_inputs_for_step_with_name_step2 ():
293
- # Arrange
294
-
295
- # Act
296
- inputs = decoder .get_workflow_job_input_names_for_step (
297
- _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW , "step2"
298
- )
299
-
300
- # Assert
301
- assert not inputs
302
-
303
-
304
- def test_get_workflow_inputs_for_step_with_unkown_step_name ():
305
- # Arrange
306
-
307
- # Act
308
- inputs = decoder .get_workflow_job_input_names_for_step (
309
- _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW , "unknown"
310
- )
311
-
312
- # Assert
313
- assert not inputs
314
-
315
-
316
200
def test_get_workflow_outputs_for_step_with_name_step1 ():
317
201
# Arrange
318
202
@@ -351,11 +235,16 @@ def test_get_workflow_outputs_for_step_with_unkown_step_name():
351
235
352
236
def test_get_step_input_variable_names_when_duplicates ():
353
237
# Arrange
238
+ workflow_filename : str = os .path .join (
239
+ os .path .dirname (__file__ ),
240
+ "workflow-definitions" ,
241
+ "duplicate-step-input-output-variable-names.yaml" ,
242
+ )
243
+ with open (workflow_filename , "r" , encoding = "utf8" ) as wf_file :
244
+ definition : Dict [str , Any ] = yaml .safe_load (wf_file )
354
245
355
246
# Act
356
- inputs = decoder .get_step_input_variable_names (
357
- _SIMPLE_PYTHON_PARALLEL_WORKFLOW , "final-step"
358
- )
247
+ inputs = decoder .get_step_input_variable_names (definition , "step-1" )
359
248
360
249
# Assert
361
250
assert len (inputs ) == 2
@@ -368,13 +257,13 @@ def test_get_step_output_variable_names_when_duplicates():
368
257
workflow_filename : str = os .path .join (
369
258
os .path .dirname (__file__ ),
370
259
"workflow-definitions" ,
371
- "duplicate-step-output-variable-names.yaml" ,
260
+ "duplicate-step-input- output-variable-names.yaml" ,
372
261
)
373
262
with open (workflow_filename , "r" , encoding = "utf8" ) as wf_file :
374
263
definition : Dict [str , Any ] = yaml .safe_load (wf_file )
375
264
376
265
# Act
377
- outputs = decoder .get_step_output_variable_names (definition , "step-1 " )
266
+ outputs = decoder .get_step_output_variable_names (definition , "step-2 " )
378
267
379
268
# Assert
380
269
assert len (outputs ) == 2
0 commit comments