Skip to content

Commit 8db0066

Browse files
committed
Bring tests in line with expected behavior.
1 parent 18d549f commit 8db0066

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

cubids/cubids.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,31 +1761,42 @@ def build_path(filepath, entities, out_dir):
17611761
... )
17621762
'/output/sub-01/ses-01/anat/sub-01_ses-01_acq-VAR_T2w.nii.gz'
17631763
1764-
The function adds an extra leading zero to the run entity when there's a zero.
1764+
The function does not add an extra leading zero to the run entity when it's a string.
17651765
>>> build_path(
17661766
... "/input/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-01_bold.nii.gz",
1767-
... {"task": "rest", "run": "01", "acquisition": "VAR", "suffix": "bold"},
1767+
... {"task": "rest", "run": "2", "acquisition": "VAR", "suffix": "bold"},
17681768
... "/output",
17691769
... )
1770-
'/output/sub-01/ses-01/func/sub-01_ses-01_task-rest_acq-VAR_run-001_bold.nii.gz'
1770+
'/output/sub-01/ses-01/func/sub-01_ses-01_task-rest_acq-VAR_run-2_bold.nii.gz'
17711771
1772-
The function adds an extra leading zero to the run entity when it's an integer.
1772+
The function adds an extra leading zero to the run entity when it's an integer
1773+
and the original filename has a leading zero.
17731774
>>> build_path(
1774-
... "/input/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-01_bold.nii.gz",
1775-
... {"task": "rest", "run": 1, "acquisition": "VAR", "suffix": "bold"},
1775+
... "/input/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-00001_bold.nii.gz",
1776+
... {"task": "rest", "run": 2, "acquisition": "VAR", "suffix": "bold"},
1777+
... "/output",
1778+
... )
1779+
'/output/sub-01/ses-01/func/sub-01_ses-01_task-rest_acq-VAR_run-00002_bold.nii.gz'
1780+
1781+
The function does not add an extra leading zero to the run entity when it's an integer
1782+
and the original filename doesn't have a leading zero.
1783+
>>> build_path(
1784+
... "/input/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-1_bold.nii.gz",
1785+
... {"task": "rest", "run": 2, "acquisition": "VAR", "suffix": "bold"},
17761786
... "/output",
17771787
... )
1778-
'/output/sub-01/ses-01/func/sub-01_ses-01_task-rest_acq-VAR_run-01_bold.nii.gz'
1788+
'/output/sub-01/ses-01/func/sub-01_ses-01_task-rest_acq-VAR_run-2_bold.nii.gz'
17791789
17801790
The function doesn't add an extra leading zero to the run entity when there isn't a zero.
17811791
>>> build_path(
17821792
... "/input/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-1_bold.nii.gz",
1783-
... {"task": "rest", "run": "1", "acquisition": "VAR", "suffix": "bold"},
1793+
... {"task": "rest", "run": "2", "acquisition": "VAR", "suffix": "bold"},
17841794
... "/output",
17851795
... )
1786-
'/output/sub-01/ses-01/func/sub-01_ses-01_task-rest_acq-VAR_run-1_bold.nii.gz'
1796+
'/output/sub-01/ses-01/func/sub-01_ses-01_task-rest_acq-VAR_run-2_bold.nii.gz'
17871797
1788-
Entities in the original path, but not the entity dictionary, are not included.
1798+
Entities in the original path, but not the entity dictionary, are not included,
1799+
like run in this case.
17891800
>>> build_path(
17901801
... "/input/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-01_bold.nii.gz",
17911802
... {"task": "rest", "acquisition": "VAR", "suffix": "bold"},

0 commit comments

Comments
 (0)