Skip to content

Commit c8afbfa

Browse files
authored
fix(test): CIFTI2 expected checksum has changed (#895)
1 parent 4359700 commit c8afbfa

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

niworkflows/interfaces/tests/test_bids.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import nibabel as nb
3232
import pytest
3333
from nipype.interfaces.base import Undefined
34+
from packaging.version import Version
3435

3536
from .. import bids as bintfs
3637
from niworkflows.testing import needs_data_dir
@@ -211,7 +212,7 @@ def connect_and_run_save(prep_result, save):
211212
{"space": "fsLR", "density": "91k"},
212213
"sub-100185/func/sub-100185_task-machinegame_run-01_"
213214
"space-fsLR_den-91k_bold.dtseries.nii",
214-
"f7b8755c6ad0d8dcdb60676331b52a23ce288b61",
215+
"335f1394ce90b58bbf27026b6eeec4d2124c11da",
215216
),
216217
(
217218
BOLD_PATH,
@@ -374,10 +375,15 @@ def test_DerivativesDataSink_build_path(
374375
assert not np.isnan(hdr["scl_slope"])
375376
assert not np.isnan(hdr["scl_inter"])
376377
for out, chksum in zip(output, checksum):
377-
if chksum == "f7b8755c6ad0d8dcdb60676331b52a23ce288b61" and sys.version_info < (3, 8):
378-
# Python 3.8 began preserving insertion order of attributes in XML
379-
# Therefore we get a different checksum before/after
380-
chksum = "a37ffb1188dd9a7b708de5b8daef46dac56ef8d4"
378+
if chksum == "335f1394ce90b58bbf27026b6eeec4d2124c11da":
379+
if sys.version_info < (3, 8):
380+
# Python 3.8 began preserving insertion order of attributes in XML
381+
# Therefore we get a different checksum before/after
382+
chksum = "a37ffb1188dd9a7b708de5b8daef46dac56ef8d4"
383+
elif Version(nb.__version__) < Version('5.3'):
384+
# Nibabel 5.3 avoids unnecessary roundtrips for Cifti2Headers
385+
# Older versions transformed a `SeriesStep="2"` into `SeriesStep="2.0"`
386+
chksum = "f7b8755c6ad0d8dcdb60676331b52a23ce288b61"
381387
assert sha1(Path(out).read_bytes()).hexdigest() == chksum
382388

383389

0 commit comments

Comments
 (0)