Skip to content

Commit e4bc7b0

Browse files
BF: don't use np.full to create string array
numpy 1.8 in python 2.7 does not like that
1 parent 2ae25b4 commit e4bc7b0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

nibabel/cifti2/tests/test_axes.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,9 @@ def test_brain_models():
171171

172172
# Test the constructor
173173
bm_vox = axes.BrainModel('thalamus_left', voxel=np.ones((5, 3), dtype=int), affine=np.eye(4), volume_shape=(2, 3, 4))
174-
print(bm_vox.name)
175-
assert np.all(bm_vox.name == np.full(5, 'CIFTI_STRUCTURE_THALAMUS_LEFT'))
176-
assert np.all(bm_vox.vertex == np.full(5, -1))
177-
assert np.all(bm_vox.voxel == np.full((5, 3), 1))
174+
assert np.all(bm_vox.name == ['CIFTI_STRUCTURE_THALAMUS_LEFT'] * 5)
175+
assert np.array_equal(bm_vox.vertex, np.full(5, -1))
176+
assert np.array_equal(bm_vox.voxel, np.full((5, 3), 1))
178177
with assert_raises(ValueError):
179178
# no volume shape
180179
axes.BrainModel('thalamus_left', voxel=np.ones((5, 3), dtype=int), affine=np.eye(4))
@@ -195,9 +194,9 @@ def test_brain_models():
195194
axes.BrainModel('thalamus_left', voxel=np.ones((5, 2), dtype=int), affine=np.eye(4), volume_shape=(2, 3, 4))
196195

197196
bm_vertex = axes.BrainModel('cortex_left', vertex=np.ones(5, dtype=int), nvertices={'cortex_left': 20})
198-
assert np.all(bm_vertex.name == np.full(5, 'CIFTI_STRUCTURE_CORTEX_LEFT'))
199-
assert np.all(bm_vertex.vertex == np.full(5, 1))
200-
assert np.all(bm_vertex.voxel == np.full((5, 3), -1))
197+
assert np.array_equal(bm_vertex.name, ['CIFTI_STRUCTURE_CORTEX_LEFT'] * 5)
198+
assert np.array_equal(bm_vertex.vertex, np.full(5, 1))
199+
assert np.array_equal(bm_vertex.voxel, np.full((5, 3), -1))
201200
with assert_raises(ValueError):
202201
axes.BrainModel('cortex_left', vertex=np.ones(5, dtype=int))
203202
with assert_raises(ValueError):

0 commit comments

Comments
 (0)