diff --git a/src/ansys/dpf/core/available_result.py b/src/ansys/dpf/core/available_result.py index 24233a86bd5..dd0aabd17be 100644 --- a/src/ansys/dpf/core/available_result.py +++ b/src/ansys/dpf/core/available_result.py @@ -195,8 +195,8 @@ def __repr__(self): @property def name(self): """Result operator.""" - if hasattr(self, "properties") and "scripting_name" in self._properties.keys(): - name = self.properties["scripting_name"] + if self._properties and "scripting_name" in self._properties.keys(): + name = self._properties["scripting_name"] elif self.operator_name in _result_properties: name = _result_properties[self.operator_name]["scripting_name"] else: diff --git a/tests/test_resultinfo.py b/tests/test_resultinfo.py index b86bc8c11b8..206e24dde52 100644 --- a/tests/test_resultinfo.py +++ b/tests/test_resultinfo.py @@ -23,7 +23,7 @@ import pytest from ansys import dpf -from ansys.dpf.core import Model +from ansys.dpf.core import Model, examples from conftest import ( SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_5_0, SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_6_0, @@ -303,3 +303,13 @@ def test_result_info_add_result(model): dimensions=None, description="description", ) + + +@pytest.mark.skipif( + not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0, reason="Available for servers >=8.0" +) +def test_scripting_name(): + model = Model(examples.download_all_kinds_of_complexity_modal()) + scripting_names = [res.name for res in model.metadata.result_info] + assert "nmisc" in scripting_names + assert "smisc" in scripting_names