Skip to content
Snippets Groups Projects
Commit b95875cb authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Unit tests for Image(indexed=True) without indexed_gzip installed

parent 6f36630f
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
import os.path as op import os.path as op
import time import time
import mock
import numpy as np import numpy as np
import nibabel as nib import nibabel as nib
...@@ -15,6 +17,19 @@ import tests ...@@ -15,6 +17,19 @@ import tests
import fsl.data.image as fslimage import fsl.data.image as fslimage
from . import make_random_image
# make sure Image(indexed=True) works
# even if indexed_gzip is not present
def test_image_indexed_no_igzip_threaded():
with mock.patch.dict('sys.modules', indexed_gzip=None):
_test_image_indexed(True)
def test_image_indexed_no_igzip_unthreaded():
with mock.patch.dict('sys.modules', indexed_gzip=None):
_test_image_indexed(False)
def test_image_indexed_threaded( ): _test_image_indexed(True) def test_image_indexed_threaded( ): _test_image_indexed(True)
def test_image_indexed_unthreaded(): _test_image_indexed(False) def test_image_indexed_unthreaded(): _test_image_indexed(False)
def _test_image_indexed(threaded): def _test_image_indexed(threaded):
...@@ -24,7 +39,7 @@ def _test_image_indexed(threaded): ...@@ -24,7 +39,7 @@ def _test_image_indexed(threaded):
filename = op.join(testdir, 'image.nii.gz') filename = op.join(testdir, 'image.nii.gz')
# Data range grows with volume # Data range grows with volume
data = np.zeros((100, 100, 100, 50)) data = np.zeros((50, 50, 50, 50))
for vol in range(data.shape[-1]): for vol in range(data.shape[-1]):
data[..., vol] = vol data[..., vol] = vol
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment