Skip to content

Commit fcf55b5

Browse files
committed
TEST: Check step = 0 case
1 parent 526d81c commit fcf55b5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

nibabel/tests/test_spatialimages.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,12 @@ def test_slicer(self):
509509
# No change to affines with upper-bound slices
510510
assert_array_equal(img.slicer[:1, :1, :1].affine, img.affine)
511511

512+
# Yell about step = 0
513+
with assert_raises(ValueError):
514+
img.slicer[:, ::0]
515+
with assert_raises(ValueError):
516+
img._slice_affine((slice(None), slice(None, None, 0)))
517+
512518
# Check data is consistent with slicing numpy arrays
513519
slice_elems = (None, Ellipsis, 0, 1, -1, [0], [1], [-1],
514520
slice(None), slice(1), slice(-1), slice(1, -1))

0 commit comments

Comments
 (0)