@@ -366,15 +366,6 @@ def test_get_data(self):
366
366
in_data_template = np .arange (24 , dtype = np .int16 ).reshape ((2 , 3 , 4 ))
367
367
in_data = in_data_template .copy ()
368
368
img = img_klass (in_data , None )
369
- # Can't slice into the image object:
370
- with pytest .raises (TypeError ) as exception_manager :
371
- img [0 , 0 , 0 ]
372
- # Make sure the right message gets raised:
373
- assert (str (exception_manager .value ) ==
374
- "Cannot slice image objects; consider using "
375
- "`img.slicer[slice]` to generate a sliced image (see "
376
- "documentation for caveats) or slicing image array data "
377
- "with `img.dataobj[slice]` or `img.get_fdata()[slice]`" )
378
369
assert in_data is img .dataobj
379
370
with pytest .deprecated_call ():
380
371
out_data = img .get_data ()
@@ -413,6 +404,16 @@ def test_slicer(self):
413
404
in_data = in_data_template .copy ().reshape (dshape )
414
405
img = img_klass (in_data , base_affine .copy ())
415
406
407
+ # Can't slice into the image object:
408
+ with pytest .raises (TypeError ) as exception_manager :
409
+ img [0 , 0 , 0 ]
410
+ # Make sure the right message gets raised:
411
+ assert (str (exception_manager .value ) ==
412
+ "Cannot slice image objects; consider using "
413
+ "`img.slicer[slice]` to generate a sliced image (see "
414
+ "documentation for caveats) or slicing image array data "
415
+ "with `img.dataobj[slice]` or `img.get_fdata()[slice]`" )
416
+
416
417
if not spatial_axes_first (img ):
417
418
with pytest .raises (ValueError ):
418
419
img .slicer
0 commit comments