Skip to content
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

fix: Update return-type of operations on named-objects. #3535

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/solver/flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ def execute_command(self, *args, **kwds):
command_name=self.python_name, value=value, kwargs=kwds
)
if (
self.obj_name == "create"
self.obj_name in ["create", "make-a-copy"]
prmukherj marked this conversation as resolved.
Show resolved Hide resolved
and isinstance(self._parent, NamedObject)
and ret in self._parent
):
Expand Down
21 changes: 21 additions & 0 deletions tests/test_settings_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ansys.fluent.core.examples import download_file
from ansys.fluent.core.solver.flobject import (
DeprecatedSettingWarning,
SettingsBase,
UnstableSettingWarning,
_Alias,
_InputFile,
Expand Down Expand Up @@ -583,3 +584,23 @@ def test_deprecated_command_arguments(mixing_elbow_case_data_session):
"m2",
"m3",
}


@pytest.mark.fluent_version(">=25.2")
def test_return_types_of_operations_on_named_objects(mixing_elbow_settings_session):
solver = mixing_elbow_settings_session

var1 = solver.settings.setup.materials.fluid.create("air-created")
prmukherj marked this conversation as resolved.
Show resolved Hide resolved
assert isinstance(var1, SettingsBase)
assert var1.obj_name == "air-created"

var2 = solver.settings.setup.materials.fluid.rename(
old="air-created", new="air-renamed"
)
assert var2 is None

var3 = solver.settings.setup.materials.fluid.make_a_copy(
from_="air-renamed", to="air-copied"
)
assert isinstance(var3, SettingsBase)
assert var3.obj_name == "air-copied"
Loading