Skip to content

Fix specification.config_specification on empty spec #2107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ansys/dpf/core/operator_specification.py
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 10 additions & 0 deletions tests/test_operator.py
Original file line number Diff line number Diff line change
@@ -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)