Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Jan 10, 2025
1 parent c002175 commit 6ab2b0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ansys/dpf/core/meshed_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ def named_selection(
A scoping containing the IDs of the entities in the named selection.
The location depends on the type of entities targeted by the named selection.
"""
out_scoping = None
if server_meet_version("2.1", self._server):
out = self._api.meshed_region_get_named_selection_scoping(self, named_selection)
out_scoping = scoping.Scoping(scoping=out, server=server)
Expand All @@ -427,6 +426,7 @@ def named_selection(
if server:
# Copy the scoping to another server
out_scoping.deep_copy(server=server)
return out_scoping

@version_requires("3.0")
def set_named_selection_scoping(self, named_selection_name, scoping):
Expand Down
12 changes: 12 additions & 0 deletions tests/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
from ansys.dpf.core import fields_container_factory
from ansys.dpf.core import fields_factory
from ansys.dpf.core import mesh_scoping_factory
from ansys.dpf.core import server
from ansys.dpf.core import server_factory
from ansys.dpf.core import time_freq_scoping_factory
from ansys.dpf.core.common import locations
from conftest import server_type


def test_create_matrix_field():
Expand Down Expand Up @@ -297,3 +300,12 @@ def test_named_selection_scoping(model_with_ns):
scop = mesh_scoping_factory.named_selection_scoping("SELECTION", model)
assert scop is not None
assert len(scop.ids) != 0


def test_named_selection_scoping_with_deepcopy(model_with_ns):
model = Model(model_with_ns)
server_2 = server.start_local_server(config=server_factory.AvailableServerConfigs.GrpcServer)
scop = mesh_scoping_factory.named_selection_scoping("SELECTION", model, server_2)
assert scop is not None
assert len(scop.ids) != 0
assert scop._server == server_2

0 comments on commit 6ab2b0b

Please sign in to comment.