From e9f4ee761549fe5f7776a2b876e7e5dd4afd58d7 Mon Sep 17 00:00:00 2001 From: cbellot Date: Mon, 28 Apr 2025 16:36:04 +0200 Subject: [PATCH 1/2] Wrong scripting name --- src/ansys/dpf/core/available_result.py | 4 ++-- tests/test_resultinfo.py | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) 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..0a900731ac0 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,10 @@ def test_result_info_add_result(model): dimensions=None, description="description", ) + + +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 From 2c79c92fbd9b3826a0e1baaba89743caddb7c466 Mon Sep 17 00:00:00 2001 From: cbellot Date: Mon, 28 Apr 2025 17:21:49 +0200 Subject: [PATCH 2/2] retro --- tests/test_resultinfo.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_resultinfo.py b/tests/test_resultinfo.py index 0a900731ac0..206e24dde52 100644 --- a/tests/test_resultinfo.py +++ b/tests/test_resultinfo.py @@ -305,6 +305,9 @@ def test_result_info_add_result(model): ) +@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]