Skip to content

Commit

Permalink
Fix usage in test
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceJoubert committed Oct 15, 2024
1 parent c1aa34c commit dd74678
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions clinica/iotools/bids_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def from_original_study_id(cls, study_id: str) -> str:
)

def to_original_study_id(self) -> str:
return str(self.replace("sub-HABS", "P_"))
return str(self).replace("sub-HABS", "P_")


class IXIBIDSSubjectID(BIDSSubjectID):
Expand All @@ -317,7 +317,7 @@ def from_original_study_id(cls, study_id: str) -> str:
)

def to_original_study_id(self) -> str:
return str(self.replace("sub-", ""))
return str(self).replace("sub-", "")


# -- Methods for the clinical data --
Expand Down
6 changes: 3 additions & 3 deletions test/unittests/iotools/test_bids_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_study_to_bids_id_value_error(study, study_id):


@pytest.mark.parametrize(
"study,expected,bids_id",
"study,source_id,bids_id",
[
(StudyName.ADNI, "001_S_0001", "sub-ADNI001S0001"),
(StudyName.NIFD, "1_S_0001", "sub-NIFD1S0001"),
Expand All @@ -106,10 +106,10 @@ def test_study_to_bids_id_value_error(study, study_id):
(StudyName.IXI, "IXI001", "sub-IXI001"),
],
)
def test_bids_to_study(study, bids_id, expected):
def test_bids_to_study(study, bids_id, source_id):
from clinica.iotools.bids_utils import bids_id_factory

assert bids_id_factory(study).to_original_study_id(bids_id) == expected
assert bids_id_factory(study)(bids_id).to_original_study_id() == source_id


def create_clinical_data(tmp_path: Path, study_name: StudyName) -> Path:
Expand Down

0 comments on commit dd74678

Please sign in to comment.