From e304e2e6cfed2e4e002fd7d463c5e0a2a99d9292 Mon Sep 17 00:00:00 2001 From: "paul.profizi" Date: Tue, 31 Oct 2023 15:43:24 +0100 Subject: [PATCH 1/2] Add treatment of files without an extension; add the case of d3plot files --- src/ansys/dpf/core/data_sources.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ansys/dpf/core/data_sources.py b/src/ansys/dpf/core/data_sources.py index d2153ed34a..14df016744 100644 --- a/src/ansys/dpf/core/data_sources.py +++ b/src/ansys/dpf/core/data_sources.py @@ -116,6 +116,10 @@ def set_result_file_path(self, filepath, key=""): ['/tmp/file.rst'] """ + # Handle the case of files without extension, such as the LS-DYNA d3plot file + if os.path.splitext(filepath)[1] == "": + if "d3plot" in os.path.basename(filepath): + key = "d3plot" if key == "": self._api.data_sources_set_result_file_path_utf8(self, str(filepath)) else: From ae987e0c233d6dfbd9a1acbd660859b173d5ee05 Mon Sep 17 00:00:00 2001 From: "paul.profizi" Date: Tue, 31 Oct 2023 15:46:31 +0100 Subject: [PATCH 2/2] Add test --- tests/test_datasources.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_datasources.py b/tests/test_datasources.py index b972359e40..37c1ac64fc 100644 --- a/tests/test_datasources.py +++ b/tests/test_datasources.py @@ -42,6 +42,11 @@ def test_addfilepathspecifiedresult_data_sources(allkindofcomplexity, server_typ data_sources.add_file_path_for_specified_result(allkindofcomplexity, "d3plot") +def test_setresultpath_data_sources_no_extension(d3plot_beam, server_type): + data_sources = dpf.core.DataSources(server=server_type) + data_sources.set_result_file_path(d3plot_beam) + + def test_addupstream_data_sources(allkindofcomplexity, server_type): data_sources = dpf.core.DataSources(server=server_type) data_sources2 = dpf.core.DataSources(server=server_type)