File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1010
1111import numpy as np
1212
13+ from ansys .dpf .core .check_version import version_requires
1314from ansys .dpf .core .server_types import BaseServer
1415from ansys .dpf .core .scoping import Scoping
1516from ansys .dpf .core .label_space import LabelSpace
@@ -74,6 +75,33 @@ def _server(self, value):
7475 # step3: init environment
7576 self ._api .init_collection_environment (self ) # creates stub when gRPC
7677
78+ @property
79+ @version_requires ("8.0" )
80+ def name (self ):
81+ """Name of the Collection.
82+
83+ Notes
84+ -----
85+ Available starting with DPF 2024 R2 pre0.
86+
87+ Returns
88+ -------
89+ str
90+ """
91+ out = self ._api .collection_get_name (self )
92+ return out if out != '' else None
93+
94+ @name .setter
95+ @version_requires ("8.0" )
96+ def name (self , name : str ):
97+ """Set the name of the Collection.
98+
99+ Notes
100+ -----
101+ Available starting with DPF 2024 R2 pre0.
102+ """
103+ self ._api .collection_set_name (self , name = name )
104+
77105 @abc .abstractmethod
78106 def create_subtype (self , obj_by_copy ):
79107 pass
Original file line number Diff line number Diff line change @@ -29,6 +29,17 @@ def test_create_fields_container(server_type):
2929 assert fc ._internal_obj is not None
3030
3131
32+ @pytest .mark .skipif (
33+ not conftest .SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0 ,
34+ reason = "Renaming collections is supported via gRPC starting server version 8.0" ,
35+ )
36+ def test_rename_fields_container (server_type ):
37+ fc = FieldsContainer (server = server_type )
38+ assert fc .name is None
39+ fc .name = "test"
40+ assert fc .name == "test"
41+
42+
3243def test_empty_index (server_type ):
3344 fc = FieldsContainer (server = server_type )
3445 with pytest .raises (IndexError ):
You can’t perform that action at this time.
0 commit comments