From 4150478296c99e99b29b50fa33b9ad50bd23ae18 Mon Sep 17 00:00:00 2001 From: Mainak Kundu Date: Thu, 19 Sep 2024 11:42:41 -0400 Subject: [PATCH 1/2] fix: Aliasing with common parent --- src/ansys/fluent/core/solver/flobject.py | 3 +-- tests/test_settings_api.py | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/ansys/fluent/core/solver/flobject.py b/src/ansys/fluent/core/solver/flobject.py index 55ec3a9421a..cb8747505bf 100644 --- a/src/ansys/fluent/core/solver/flobject.py +++ b/src/ansys/fluent/core/solver/flobject.py @@ -745,8 +745,7 @@ def _unalias(self, cls, value): ) outer_set_states.extend(o_set_states) else: - ret_alias[comp] = {} - ret_alias = ret_alias[comp] + ret_alias = ret_alias.setdefault(comp, {}) else: if issubclass(cls, Group): ccls = cls._child_classes[k] diff --git a/tests/test_settings_api.py b/tests/test_settings_api.py index 14b668ca12e..f2d17cad653 100644 --- a/tests/test_settings_api.py +++ b/tests/test_settings_api.py @@ -217,7 +217,7 @@ def test_api_upgrade(new_solver_session, capsys): @pytest.mark.fluent_version(">=24.2") -def test_deprecated_settings(new_solver_session): +def test_deprecated_settings_with_custom_aliases(new_solver_session): solver = new_solver_session if solver.get_fluent_version() >= FluentVersion.v251: # https://github.com/ansys/pyfluent/issues/3134 @@ -359,6 +359,27 @@ def test_deprecated_settings(new_solver_session): } +@pytest.mark.fluent_version(">=24.2") +def test_deprecated_settings_with_settings_api_aliases(new_solver_session): + solver = new_solver_session + case_path = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow") + download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow") + solver.settings.file.read_case_data(file_name=case_path) + solver.settings.results.surfaces.iso_clip["clip-1"] = {} + assert solver.settings.results.surfaces.iso_clip["clip-1"].range() == { + "minimum": 0, + "maximum": 0, + } + solver.settings.results.surfaces.iso_clip["clip-1"] = { + "min": -0.0001, + "max": 0.0001, + } + assert solver.settings.results.surfaces.iso_clip["clip-1"].range() == { + "minimum": -0.0001, + "maximum": 0.0001, + } + + @pytest.mark.fluent_version(">=23.1") def test_command_return_type(new_solver_session): solver = new_solver_session From 5fe3a3b186008d179ff996556e7058c8bf8778c3 Mon Sep 17 00:00:00 2001 From: Mainak Kundu Date: Thu, 19 Sep 2024 12:43:55 -0400 Subject: [PATCH 2/2] fix: fix test --- tests/test_settings_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_settings_api.py b/tests/test_settings_api.py index f2d17cad653..e7a9efae298 100644 --- a/tests/test_settings_api.py +++ b/tests/test_settings_api.py @@ -359,7 +359,7 @@ def test_deprecated_settings_with_custom_aliases(new_solver_session): } -@pytest.mark.fluent_version(">=24.2") +@pytest.mark.fluent_version(">=25.1") def test_deprecated_settings_with_settings_api_aliases(new_solver_session): solver = new_solver_session case_path = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")