Skip to content

Commit

Permalink
FIX: Functions return File instances. Names of test functions switche…
Browse files Browse the repository at this point in the history
…d. (#336)
  • Loading branch information
ekrja authored Oct 2, 2024
1 parent 8d32e61 commit b1cd07c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/ansys/optislang/core/tcp/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2201,7 +2201,7 @@ def save_designs_as_json(self, hid: str, file_path: Union[Path, str]) -> File:
ValueError
Raised when ``hid`` does not exist.
"""
self.__save_designs_as(hid, file_path, FileOutputFormat.JSON)
return self.__save_designs_as(hid, file_path, FileOutputFormat.JSON)

def save_designs_as_csv(self, hid: str, file_path: Union[Path, str]) -> File:
"""Save designs for a given state to CSV file.
Expand Down Expand Up @@ -2233,7 +2233,7 @@ def save_designs_as_csv(self, hid: str, file_path: Union[Path, str]) -> File:
ValueError
Raised when ``hid`` does not exist.
"""
self.__save_designs_as(hid, file_path, FileOutputFormat.CSV)
return self.__save_designs_as(hid, file_path, FileOutputFormat.CSV)

def __save_designs_as(self, hid: str, file_path: Union[Path, str], format: FileOutputFormat):
"""Save designs for a given state.
Expand Down
10 changes: 5 additions & 5 deletions tests/tcp/test_tcp_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,12 @@ def test_save_designs_as(tmp_path: Path, tmp_example_project):
project = osl.project
root_system = project.root_system

__test_save_designs_as_json(tmp_path, root_system)
__test_save_designs_as_csv(tmp_path, root_system)
__test_save_designs_as_json(tmp_path, root_system)


def __test_save_designs_as_json(tmp_path: Path, root_system: TcpRootSystemProxy):
"""Test `save_designs_as_json` method."""
def __test_save_designs_as_csv(tmp_path: Path, root_system: TcpRootSystemProxy):
"""Test `save_designs_as_csv` method."""
sensitivity: TcpParametricSystemProxy = root_system.find_nodes_by_name("Sensitivity")[0]
s_hids = sensitivity.get_states_ids()
csv_file_path = tmp_path / "FirstDesign.csv"
Expand All @@ -470,8 +470,8 @@ def __test_save_designs_as_json(tmp_path: Path, root_system: TcpRootSystemProxy)
assert csv_file.exists


def __test_save_designs_as_csv(tmp_path: Path, root_system: TcpRootSystemProxy):
"""Test `save_designs_as_csv` method."""
def __test_save_designs_as_json(tmp_path: Path, root_system: TcpRootSystemProxy):
"""Test `save_designs_as_json` method."""
most_inner_sensitivity: TcpParametricSystemProxy = root_system.find_nodes_by_name(
"MostInnerSensitivity", 3
)[0]
Expand Down

0 comments on commit b1cd07c

Please sign in to comment.