Skip to content

Commit 381ad1c

Browse files
committed
TEST: Test supported dtypes for Analyze/NIfTI/MGH
1 parent 460c8d9 commit 381ad1c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

nibabel/tests/test_proxy_api.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from .._h5py_compat import h5py, have_h5py
4848
from .. import ecat
4949
from .. import parrec
50+
from ..casting import have_binary128
5051

5152
from ..arrayproxy import ArrayProxy, is_proxy
5253

@@ -192,6 +193,7 @@ class TestAnalyzeProxyAPI(_TestProxyAPI):
192193
shapes = ((2,), (2, 3), (2, 3, 4), (2, 3, 4, 5))
193194
has_slope = False
194195
has_inter = False
196+
data_dtypes = (np.uint8, np.int16, np.int32, np.float32, np.complex64, np.float64)
195197
array_order = 'F'
196198
# Cannot set offset for Freesurfer
197199
settable_offset = True
@@ -218,9 +220,8 @@ def obj_params(self):
218220
offsets = (0, 16)
219221
slopes = (1., 2., 3.1416) if self.has_slope else (1.,)
220222
inters = (0., 10., 2.7183) if self.has_inter else (0.,)
221-
dtypes = (np.uint8, np.int16, np.float32)
222223
for shape, dtype, offset, slope, inter in product(self.shapes,
223-
dtypes,
224+
self.data_dtypes,
224225
offsets,
225226
slopes,
226227
inters):
@@ -325,6 +326,10 @@ class TestSpm2AnalyzeProxyAPI(TestSpm99AnalyzeProxyAPI):
325326
class TestNifti1ProxyAPI(TestSpm99AnalyzeProxyAPI):
326327
header_class = Nifti1Header
327328
has_inter = True
329+
data_dtypes = (np.uint8, np.int16, np.int32, np.float32, np.complex64, np.float64,
330+
np.int8, np.uint16, np.uint32, np.int64, np.uint64, np.complex128)
331+
if have_binary128():
332+
data_dtypes.extend(np.float128, np.complex256)
328333

329334

330335
class TestMGHAPI(TestAnalyzeProxyAPI):
@@ -334,6 +339,7 @@ class TestMGHAPI(TestAnalyzeProxyAPI):
334339
has_inter = False
335340
settable_offset = False
336341
data_endian = '>'
342+
data_dtypes = (np.uint8, np.int16, np.int32, np.float32)
337343

338344

339345
class TestMinc1API(_TestProxyAPI):

0 commit comments

Comments
 (0)