Skip to content

Commit

Permalink
fix: Update return-type of operations on named-objects. (#3535)
Browse files Browse the repository at this point in the history
* fix: Update return-type of operations on named-objects.

* Update test.
  • Loading branch information
prmukherj authored Dec 20, 2024
1 parent 6da01a1 commit 1c823f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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 @@ -1673,7 +1673,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"]
and isinstance(self._parent, NamedObject)
and ret in self._parent
):
Expand Down
20 changes: 20 additions & 0 deletions tests/test_settings_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,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")
assert var1 == solver.settings.setup.materials.fluid["air-created"]
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 var3 == solver.settings.setup.materials.fluid["air-copied"]
assert var3.obj_name == "air-copied"

0 comments on commit 1c823f4

Please sign in to comment.