1212from nibabel import cifti2 as ci
1313from nibabel .tmpdirs import InTemporaryDirectory
1414
15- from nose .tools import assert_true , assert_equal
15+ from nose .tools import assert_true , assert_equal , assert_raises
1616
1717affine = [[- 1.5 , 0 , 0 , 90 ],
1818 [0 , 1.5 , 0 , - 85 ],
@@ -213,6 +213,8 @@ def test_dtseries():
213213 hdr = ci .Cifti2Header (matrix )
214214 data = np .random .randn (13 , 9 )
215215 img = ci .Cifti2Image (data , hdr )
216+ with assert_raises (ValueError ):
217+ img .to_filename ('test.dtseries.nii' )
216218 img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_DENSE_SERIES' )
217219
218220 with InTemporaryDirectory ():
@@ -234,6 +236,8 @@ def test_dscalar():
234236 hdr = ci .Cifti2Header (matrix )
235237 data = np .random .randn (2 , 9 )
236238 img = ci .Cifti2Image (data , hdr )
239+ with assert_raises (ValueError ):
240+ nib .save (img , 'test.dscalar.nii' )
237241 img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_DENSE_SCALARS' )
238242
239243 with InTemporaryDirectory ():
@@ -255,6 +259,8 @@ def test_dlabel():
255259 hdr = ci .Cifti2Header (matrix )
256260 data = np .random .randn (2 , 9 )
257261 img = ci .Cifti2Image (data , hdr )
262+ with assert_raises (ValueError ):
263+ ci .save (img , 'test.dlabel.nii' )
258264 img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_DENSE_LABELS' )
259265
260266 with InTemporaryDirectory ():
@@ -379,7 +385,7 @@ def test_plabel():
379385 matrix .append (parcel_map )
380386 hdr = ci .Cifti2Header (matrix )
381387 data = np .random .randn (2 , 3 )
382- img = ci .Cifti2Image (data , hdr
388+ img = ci .Cifti2Image (data , hdr )
383389 img .nifti_header .set_intent ('NIFTI_INTENT_CONNECTIVITY_UNKNOWN' )
384390
385391 with InTemporaryDirectory ():
0 commit comments