Commit 1ab49ce6 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

unit tests for ensure module

parent 976f5414
#!/usr/bin/env python
#
# test_ensure.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import numpy as np
import nibabel as nib
import fsl.utils.tempdir as tempdir
import fsl.utils.ensure as ensure
from . import make_random_image
def test_ensureIsImage():
with tempdir.tempdir():
img = make_random_image('image.nii')
assert ensure.ensureIsImage(img) is img
loaded = ensure.ensureIsImage('image.nii')
assert isinstance(loaded, nib.nifti1.Nifti1Image)
assert np.all(img.get_data() == loaded.get_data())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment