@@ -56,16 +56,17 @@ def test_geometry():
56
56
assert_equal (coords .shape [0 ], faces .max () + 1 )
57
57
58
58
# Test quad with sphere
59
- with clear_and_catch_warnings ():
59
+ surf_path = pjoin (data_path , "surf" , "%s.%s" % ("lh" , "sphere" ))
60
+ with clear_and_catch_warnings () as w :
60
61
warnings .filterwarnings ('always' , category = DeprecationWarning )
61
- surf_path = pjoin (data_path , "surf" , "%s.%s" % ("lh" , "sphere" ))
62
62
coords , faces , volume_info , create_stamp = \
63
63
read_geometry (surf_path , read_metadata = True , read_stamp = True )
64
- assert_equal (0 , faces .min ())
65
- assert_equal (coords .shape [0 ], faces .max () + 1 )
66
- assert_equal (0 , len (volume_info ))
67
- assert_equal (u'created by greve on Thu Jun 8 19:17:51 2006' ,
68
- create_stamp )
64
+ assert_true (any ('extension code' in str (ww .message ) for ww in w ))
65
+ assert_equal (0 , faces .min ())
66
+ assert_equal (coords .shape [0 ], faces .max () + 1 )
67
+ assert_equal (0 , len (volume_info ))
68
+ assert_equal (u'created by greve on Thu Jun 8 19:17:51 2006' ,
69
+ create_stamp )
69
70
70
71
# Test equivalence of freesurfer- and nibabel-generated triangular files
71
72
# with respect to read_geometry()
@@ -84,6 +85,14 @@ def test_geometry():
84
85
np .fromfile (fobj , ">u1" , 3 )
85
86
read_create_stamp = fobj .readline ().decode ().rstrip ('\n ' )
86
87
88
+ # now write an incomplete file
89
+ write_geometry (surf_path , coords , faces )
90
+ with clear_and_catch_warnings () as w :
91
+ warnings .filterwarnings ('always' , category = DeprecationWarning )
92
+ read_geometry (surf_path , read_metadata = True )
93
+ assert_true (any ('volume information contained' in str (ww .message )
94
+ for ww in w ))
95
+
87
96
assert_equal (create_stamp , read_create_stamp )
88
97
89
98
np .testing .assert_array_equal (coords , coords2 )
0 commit comments