|
30 | 30 | _SIMPLE_PYTHON_MOLPROPS_WORKFLOW: Dict[str, Any] = yaml.safe_load(workflow_file)
|
31 | 31 | assert _SIMPLE_PYTHON_MOLPROPS_WORKFLOW
|
32 | 32 |
|
| 33 | +_SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW_FILE: str = os.path.join( |
| 34 | + os.path.dirname(__file__), |
| 35 | + "workflow-definitions", |
| 36 | + "simple-python-molprops-with-options.yaml", |
| 37 | +) |
| 38 | +with open( |
| 39 | + _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW_FILE, "r", encoding="utf8" |
| 40 | +) as workflow_file: |
| 41 | + _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW: Dict[str, Any] = yaml.safe_load( |
| 42 | + workflow_file |
| 43 | + ) |
| 44 | +assert _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW |
| 45 | + |
33 | 46 | _DUPLICATE_WORKFLOW_VARIABLE_NAMES_WORKFLOW_FILE: str = os.path.join(
|
34 | 47 | os.path.dirname(__file__),
|
35 | 48 | "workflow-definitions",
|
@@ -206,3 +219,41 @@ def test_get_workflow_variables_for_duplicate_variables():
|
206 | 219 | assert len(names) == 2
|
207 | 220 | assert names[0] == "x"
|
208 | 221 | assert names[1] == "x"
|
| 222 | + |
| 223 | + |
| 224 | +def test_get_required_variable_names_for_simnple_python_molprops_with_options(): |
| 225 | + # Arrange |
| 226 | + |
| 227 | + # Act |
| 228 | + rqd_variables = decoder.get_required_variable_names( |
| 229 | + _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW |
| 230 | + ) |
| 231 | + |
| 232 | + # Assert |
| 233 | + assert len(rqd_variables) == 2 |
| 234 | + assert "candidateMolecules" in rqd_variables |
| 235 | + assert "rdkitPropertyValue" in rqd_variables |
| 236 | + |
| 237 | + |
| 238 | +@pytest.mark.skip(reason="The decoder does not currently handle options processing") |
| 239 | +def test_set_variables_from_options_for_step_for_simnple_python_molprops_with_options(): |
| 240 | + # Arrange |
| 241 | + variables = { |
| 242 | + "rdkitPropertyName": "propertyName", |
| 243 | + "rdkitPropertyValue": "propertyValue", |
| 244 | + } |
| 245 | + |
| 246 | + # Act |
| 247 | + new_variables, error = decoder.set_variables_from_options_for_step( |
| 248 | + _SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW, |
| 249 | + variables, |
| 250 | + "step1", |
| 251 | + ) |
| 252 | + |
| 253 | + # Assert |
| 254 | + assert error is None |
| 255 | + assert len(new_variables) == 4 |
| 256 | + assert "name" in new_variables |
| 257 | + assert "value" in new_variables |
| 258 | + assert new_variables["name"] == "propertyName" |
| 259 | + assert new_variables["value"] == "propertyValue" |
0 commit comments