Skip to content

Commit f349ed2

Browse files
committed
fix warning and tests
1 parent 05660cc commit f349ed2

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

heudiconv/convert.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ class PopulateIntendedForOpts(TypedDict, total=False):
6161

6262

6363
LOCKFILE = "heudiconv.lock"
64-
DW_IMAGE_IN_FMAP_FOLDER_WARNING = (
65-
"Diffusion-weighted image saved in non dwi folder ({folder})"
66-
)
64+
DW_IMAGE_WRONG_SUFFIX_WARNING = "Diffusion-weighted image saved as non dwi ({prefix})"
6765
lgr = logging.getLogger(__name__)
6866

6967

@@ -907,9 +905,7 @@ def save_converted_files(
907905
os.remove(ftr)
908906
lgr.debug("%s and %s were removed since not dwi", bvecs, bvals)
909907
else:
910-
lgr.warning(
911-
DW_IMAGE_IN_FMAP_FOLDER_WARNING.format(folder=prefix_dirname)
912-
)
908+
lgr.warning(DW_IMAGE_WRONG_SUFFIX_WARNING.format(prefix=prefix))
913909
lgr.warning(
914910
".bvec and .bval files will be generated. This is NOT BIDS compliant"
915911
)

heudiconv/tests/test_convert.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from heudiconv.cli.run import main as runner
1414
import heudiconv.convert
1515
from heudiconv.convert import (
16-
DW_IMAGE_IN_FMAP_FOLDER_WARNING,
16+
DW_IMAGE_WRONG_SUFFIX_WARNING,
1717
bvals_are_zero,
1818
update_complex_name,
1919
update_multiecho_name,
@@ -170,8 +170,8 @@ def test_b0dwi_for_fmap(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> Non
170170

171171
# assert that it raised a warning that the fmap directory will contain
172172
# bvec and bval files.
173-
expected_msg = DW_IMAGE_IN_FMAP_FOLDER_WARNING.format(
174-
folder=op.join(tmp_path, f"sub-{subID}", "fmap")
173+
expected_msg = DW_IMAGE_WRONG_SUFFIX_WARNING.format(
174+
prefix=op.join(tmp_path, f"sub-{subID}", "fmap", f"sub-{subID}_acq-b0dwi_epi")
175175
)
176176
assert any(expected_msg in c.message for c in caplog.records)
177177

0 commit comments

Comments
 (0)