Skip to content

Commit a1400bd

Browse files
committed
ENH(TST): test that we issue a warning upon multiple matches
1 parent 748ce00 commit a1400bd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

nibabel/tests/test_nifti1.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@
3838
from nose.tools import (assert_true, assert_false, assert_equal,
3939
assert_raises)
4040

41-
from ..testing import data_path, suppress_warnings, runif_extra_has
41+
from ..testing import (
42+
clear_and_catch_warnings,
43+
data_path,
44+
runif_extra_has,
45+
suppress_warnings,
46+
)
4247

4348
from . import test_analyze as tana
4449
from . import test_spm99analyze as tspm
@@ -563,7 +568,9 @@ def test_slice_times(self):
563568
hdr2.set_dim_info(slice=2)
564569
hdr2.set_slice_duration(0.1)
565570
hdr2.set_data_shape((1, 1, 2))
566-
hdr2.set_slice_times([0.1, 0]) # will generate warning that multiple match
571+
with clear_and_catch_warnings() as w:
572+
hdr2.set_slice_times([0.1, 0])
573+
assert len(w) == 1
567574
# but always must be choosing sequential one first
568575
assert_equal(hdr2.get_value_label('slice_code'), 'sequential decreasing')
569576
# and the other direction

0 commit comments

Comments
 (0)