From 59c265a23e9f1347628216e0932e60188f70cf5a Mon Sep 17 00:00:00 2001 From: PProfizi Date: Fri, 21 Feb 2025 11:43:50 +0100 Subject: [PATCH 1/2] Querying Specification.config_specification on an empty spec now returns an empty ConfigSpecification instead of throwing. --- src/ansys/dpf/core/operator_specification.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/dpf/core/operator_specification.py b/src/ansys/dpf/core/operator_specification.py index 5fe6070e64..830cea4469 100644 --- a/src/ansys/dpf/core/operator_specification.py +++ b/src/ansys/dpf/core/operator_specification.py @@ -460,6 +460,7 @@ def config_specification(self) -> ConfigSpecification: """ if self._config_specification is None: self._config_specification = ConfigSpecification() + if self._internal_obj is not None: num_options = self._api.operator_specification_get_num_config_options(self) for i in range(num_options): option_name = self._api.operator_specification_get_config_name(self, i) From bd01ac190e3f35af2ea3ca6089fa66de7a27e16a Mon Sep 17 00:00:00 2001 From: PProfizi Date: Fri, 21 Feb 2025 11:56:40 +0100 Subject: [PATCH 2/2] Add test --- tests/test_operator.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_operator.py b/tests/test_operator.py index fdef9abdd1..aa25474414 100644 --- a/tests/test_operator.py +++ b/tests/test_operator.py @@ -1328,6 +1328,16 @@ def test_generated_operator_config_specification_simple(server_type): assert "id" in conf_spec["work_by_index"].document +def test_empty_specification(server_type): + op = dpf.core.dpf_operator.Operator("chunk_fc", server=server_type) + spec = op.specification + _ = spec.config_specification + _ = spec.properties + _ = spec.description + _ = spec.inputs + _ = spec.outputs + + def test_operator_exception(): ds = dpf.core.DataSources(r"dummy/file.rst") op = ops.result.displacement(data_sources=ds)