Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
1ab49ce6
Commit
1ab49ce6
authored
Feb 28, 2018
by
Paul McCarthy
🚵
Browse files
unit tests for ensure module
parent
976f5414
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/test_ensure.py
0 → 100644
View file @
1ab49ce6
#!/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
())
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment