From e98bd4472797431620db085735d917714b7fc23f Mon Sep 17 00:00:00 2001 From: AliceJoubert Date: Tue, 22 Oct 2024 17:34:16 +0200 Subject: [PATCH] proposition --- clinica/iotools/converters/adni_to_bids/adni_utils.py | 2 +- .../iotools/converters/adni_to_bids/test_adni_utils.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/clinica/iotools/converters/adni_to_bids/adni_utils.py b/clinica/iotools/converters/adni_to_bids/adni_utils.py index 2ac56a99d..c79631787 100644 --- a/clinica/iotools/converters/adni_to_bids/adni_utils.py +++ b/clinica/iotools/converters/adni_to_bids/adni_utils.py @@ -1109,7 +1109,7 @@ def load_clinical_csv(clinical_dir: Path, filename: str) -> pd.DataFrame: pattern = filename + r"(_\d{1,2}[A-Za-z]{3}\d{4})?.csv" files_matching_pattern = [ - f for f in clinical_dir.rglob("*.csv") if re.search(pattern, f.name) + f for f in clinical_dir.rglob("[!.]*.csv") if re.search(pattern, f.name) ] if len(files_matching_pattern) != 1: raise IOError( diff --git a/test/unittests/iotools/converters/adni_to_bids/test_adni_utils.py b/test/unittests/iotools/converters/adni_to_bids/test_adni_utils.py index 951d7ce36..540391a98 100644 --- a/test/unittests/iotools/converters/adni_to_bids/test_adni_utils.py +++ b/test/unittests/iotools/converters/adni_to_bids/test_adni_utils.py @@ -236,7 +236,7 @@ def test_compute_session_id(csv_filename, visit_code_column_name): @pytest.fixture -def input_df(): +def input_df() -> pd.DataFrame: return pd.DataFrame( { "foo": ["foo1", "foo2", "foo3"], @@ -255,6 +255,7 @@ def test_load_clinical_csv(tmp_path, input_df, csv_name, csv_to_look_for): from clinica.iotools.converters.adni_to_bids.adni_utils import load_clinical_csv input_df.to_csv(tmp_path / csv_name, index=False) + pd.DataFrame().to_csv(tmp_path / f".{csv_name}") assert_frame_equal(load_clinical_csv(tmp_path, csv_to_look_for), input_df) @@ -278,8 +279,6 @@ def test_load_clinical_csv_error( def test_load_clinical_csv_value_error(tmp_path): - import re - from clinica.iotools.converters.adni_to_bids.adni_utils import load_clinical_csv with open(tmp_path / "adnimerge.csv", "w") as fp: