Skip to content
Snippets Groups Projects
Commit 9dfd2a7c authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: Regression test for gifti bug, fix error in image test

parent fdfdd403
No related branches found
No related tags found
No related merge requests found
...@@ -288,12 +288,18 @@ def test_GiftiMesh_multiple_vertices(): ...@@ -288,12 +288,18 @@ def test_GiftiMesh_multiple_vertices():
verts1 = TEST_VERT_ARRAY verts1 = TEST_VERT_ARRAY
verts2 = nib.gifti.GiftiDataArray( verts2 = nib.gifti.GiftiDataArray(
TEST_VERTS * 5, intent='NIFTI_INTENT_POINTSET') TEST_VERTS * 5, intent='NIFTI_INTENT_POINTSET')
verts3 = nib.gifti.GiftiDataArray(
TEST_VERTS * 10, intent='NIFTI_INTENT_POINTSET')
gimg = nib.gifti.GiftiImage(darrays=[verts1, verts2, tris]) gimg = nib.gifti.GiftiImage(darrays=[verts1, verts2, tris])
gimg2 = nib.gifti.GiftiImage(darrays=[verts3])
with tempdir(): with tempdir():
fname = op.abspath('test.gii') fname = op.abspath('test.gii')
gimg.to_filename(fname) fname2 = op.abspath('test2.gii')
gimg .to_filename(fname)
gimg2.to_filename(fname2)
surf = gifti.GiftiMesh(fname) surf = gifti.GiftiMesh(fname)
expvsets = [fname, expvsets = [fname,
...@@ -304,9 +310,11 @@ def test_GiftiMesh_multiple_vertices(): ...@@ -304,9 +310,11 @@ def test_GiftiMesh_multiple_vertices():
assert surf.vertexSets() == expvsets assert surf.vertexSets() == expvsets
surf.vertices = expvsets[1] surf.vertices = expvsets[1]
assert np.all(surf.vertices == TEST_VERTS * 5) assert np.all(surf.vertices == TEST_VERTS * 5)
surf.loadVertices(fname2, select=True)
assert np.all(surf.vertices == TEST_VERTS * 10)
def test_GiftiMesh_needsFixing(): def test_GiftiMesh_needsFixing():
from . import test_mesh from . import test_mesh
......
...@@ -306,7 +306,7 @@ def _test_Image_atts(imgtype): ...@@ -306,7 +306,7 @@ def _test_Image_atts(imgtype):
assert tuple(i.nibImage.shape) == tuple(dims) assert tuple(i.nibImage.shape) == tuple(dims)
assert tuple(i.nibImage.header.get_zooms()) == tuple(pixdims) assert tuple(i.nibImage.header.get_zooms()) == tuple(pixdims)
asert i.nvals == 1 assert i.nvals == 1
assert i.ndim == expndims assert i.ndim == expndims
assert i.dtype == dtype assert i.dtype == dtype
assert i.name == op.basename(path) assert i.name == op.basename(path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment