Skip to content

Commit

Permalink
Merge pull request #1 from effigies/test/1237
Browse files Browse the repository at this point in the history
TEST: Add test file with bad spacing field
  • Loading branch information
petsuter authored Jul 12, 2023
2 parents ff4f855 + 43895ef commit ba88e43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Binary file added nibabel/tests/data/minc2_baddim.mnc
Binary file not shown.
10 changes: 10 additions & 0 deletions nibabel/tests/test_minc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from os.path import join as pjoin

import numpy as np
import pytest

from .. import minc2
from ..minc2 import Minc2File, Minc2Image
Expand Down Expand Up @@ -121,3 +122,12 @@ class TestMinc2Image(tm2.TestMinc1Image):
image_class = Minc2Image
eg_images = (pjoin(data_path, 'small.mnc'),)
module = minc2


def test_bad_diminfo():
fname = pjoin(data_path, 'minc2_baddim.mnc')
# File has a bad spacing field 'xspace' when it should be
# `irregular`, `regular__` or absent (default to regular__).
# We interpret an invalid spacing as absent, but warn.
with pytest.warns(UserWarning) as w:
Minc2Image.from_filename(fname)

0 comments on commit ba88e43

Please sign in to comment.