From 28b26de9116b047a92cd0ee8b03579123124cbaa Mon Sep 17 00:00:00 2001 From: Mainak Kundu Date: Tue, 29 Oct 2024 07:42:46 -0400 Subject: [PATCH] feat: Add test --- .../core/solver/settings_builtin_data.py | 4 +++ tests/test_builtin_settings.py | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/ansys/fluent/core/solver/settings_builtin_data.py b/src/ansys/fluent/core/solver/settings_builtin_data.py index 9b1503590f22..490670efaff5 100644 --- a/src/ansys/fluent/core/solver/settings_builtin_data.py +++ b/src/ansys/fluent/core/solver/settings_builtin_data.py @@ -946,4 +946,8 @@ FluentVersion.v231: "results.report.simulation_reports", }, ), + "ParametricStudies": ("Singleton", "parametric_studies"), + "ParametricStudy": ("NamedObject", "parametric_studies"), + "DesignPoints": ("Singleton", "parametric_studies.design_points"), + "DesignPoint": ("NamedObject", "parametric_studies.design_points"), } diff --git a/tests/test_builtin_settings.py b/tests/test_builtin_settings.py index f6f952d091e0..fede8ed233e0 100644 --- a/tests/test_builtin_settings.py +++ b/tests/test_builtin_settings.py @@ -1,3 +1,6 @@ +from pathlib import Path +import tempfile + import pytest try: @@ -19,6 +22,8 @@ CumulativePlots, CustomFieldFunctions, CustomVectors, + DesignPoint, + DesignPoints, DiscretePhase, DiscretePhaseHistogram, DynamicMesh, @@ -56,6 +61,8 @@ NamedExpressions, Optics, OutputParameters, + ParametricStudies, + ParametricStudy, ParticleTracks, PartitionSurfaces, Pathlines, @@ -112,6 +119,7 @@ ) except ImportError: pass # for no-codegen testing workflow +import ansys.fluent.core as pyfluent from ansys.fluent.core.examples import download_file from ansys.fluent.core.utils.fluent_version import FluentVersion @@ -630,6 +638,26 @@ def test_builtin_settings(mixing_elbow_case_data_session): else: with pytest.raises(RuntimeError): CustomVectors(settings_source=solver) + tmp_save_path = tempfile.mkdtemp(dir=pyfluent.EXAMPLES_PATH) + project_file = Path(tmp_save_path) / "mixing_elbow_param.flprj" + solver.settings.parametric_studies.initialize(project_filename=str(project_file)) + assert ParametricStudies(settings_source=solver) == solver.parametric_studies + assert ( + ParametricStudy(settings_source=solver, name="mixing_elbow-Solve") + == solver.parametric_studies["mixing_elbow-Solve"] + ) + assert ( + DesignPoints(settings_source=solver, parametric_studies="mixing_elbow-Solve") + == solver.parametric_studies["mixing_elbow-Solve"].design_points + ) + assert ( + DesignPoint( + settings_source=solver, + parametric_studies="mixing_elbow-Solve", + name="Base DP", + ) + == solver.parametric_studies["mixing_elbow-Solve"].design_points["Base DP"] + ) @pytest.mark.codegen_required