Skip to content

Commit ba88e43

Browse files
authored
Merge pull request #1 from effigies/test/1237
TEST: Add test file with bad spacing field
2 parents ff4f855 + 43895ef commit ba88e43

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

nibabel/tests/data/minc2_baddim.mnc

19.4 KB
Binary file not shown.

nibabel/tests/test_minc2.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from os.path import join as pjoin
1111

1212
import numpy as np
13+
import pytest
1314

1415
from .. import minc2
1516
from ..minc2 import Minc2File, Minc2Image
@@ -121,3 +122,12 @@ class TestMinc2Image(tm2.TestMinc1Image):
121122
image_class = Minc2Image
122123
eg_images = (pjoin(data_path, 'small.mnc'),)
123124
module = minc2
125+
126+
127+
def test_bad_diminfo():
128+
fname = pjoin(data_path, 'minc2_baddim.mnc')
129+
# File has a bad spacing field 'xspace' when it should be
130+
# `irregular`, `regular__` or absent (default to regular__).
131+
# We interpret an invalid spacing as absent, but warn.
132+
with pytest.warns(UserWarning) as w:
133+
Minc2Image.from_filename(fname)

0 commit comments

Comments
 (0)