Skip to content

Commit 929dbc3

Browse files
committed
TEST: Add round-trip test
1 parent e018adf commit 929dbc3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

nibabel/freesurfer/tests/test_io.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from nose.tools import assert_true
1414
import numpy as np
15-
from numpy.testing import assert_equal, assert_raises, dec, assert_allclose
15+
from numpy.testing import assert_equal, assert_raises, dec, assert_allclose, assert_array_equal
1616

1717
from .. import (read_geometry, read_morph_data, read_annot, read_label,
1818
write_geometry, write_morph_data, write_annot)
@@ -369,4 +369,9 @@ def test_write_annot_maxstruct():
369369
annot_path = 'c.annot'
370370

371371
write_annot(annot_path, labels, rgba, names)
372-
read_annot(annot_path)
372+
# Validate the file can be read
373+
rt_labels, rt_ctab, rt_names = read_annot(annot_path)
374+
# Check round-trip
375+
assert_array_equal(labels, rt_labels)
376+
assert_array_equal(rgba, rt_ctab[:, :4])
377+
assert_equal(names, [n.decode('ascii') for n in rt_names])

0 commit comments

Comments
 (0)