Skip to content

Commit 5cd1994

Browse files
committed
More proxy tests
1 parent 09e1360 commit 5cd1994

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nibabel/tests/test_image_api.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@
3737

3838
from .. import (AnalyzeImage, Spm99AnalyzeImage, Spm2AnalyzeImage,
3939
Nifti1Pair, Nifti1Image, Nifti2Pair, Nifti2Image,
40-
MGHImage, Minc1Image, Minc2Image)
40+
MGHImage, Minc1Image, Minc2Image, is_proxy)
4141
from ..spatialimages import SpatialImage
4242
from .. import minc1, minc2, parrec
4343

4444
from nose import SkipTest
45-
from nose.tools import (assert_true, assert_false, assert_raises,
46-
assert_equal, assert_not_equal)
45+
from nose.tools import (assert_true, assert_false, assert_raises, assert_equal)
4746

4847
from numpy.testing import (assert_almost_equal, assert_array_equal)
4948
from ..testing import clear_and_catch_warnings
@@ -203,8 +202,13 @@ def validate_data_interface(self, imaker, params):
203202
assert_data_similar(img.dataobj, params)
204203
for meth_name in ('get_fdata', 'get_data'):
205204
if params['is_proxy']:
205+
# Parameters assert this is an array proxy
206206
img = imaker()
207+
# Does is_proxy agree?
208+
assert_true(is_proxy(img.dataobj))
209+
# Confirm it is not a numpy array
207210
assert_false(isinstance(img.dataobj, np.ndarray))
211+
# Confirm it can be converted to a numpy array with is_array
208212
proxy_data = np.asarray(img.dataobj)
209213
proxy_copy = proxy_data.copy()
210214
# Not yet cached, proxy image: in_memory is False

0 commit comments

Comments
 (0)