@@ -51,18 +51,18 @@ def test_geometry():
51
51
"""Test IO of .surf"""
52
52
surf_path = pjoin (data_path , "surf" , "%s.%s" % ("lh" , "inflated" ))
53
53
coords , faces = read_geometry (surf_path )
54
- assert 0 == faces .min ()
55
- assert coords .shape [0 ]== faces .max () + 1
54
+ assert 0 == faces .min ()
55
+ assert coords .shape [0 ] == faces .max () + 1
56
56
57
57
surf_path = pjoin (data_path , "surf" , "%s.%s" % ("lh" , "sphere" ))
58
58
coords , faces , volume_info , create_stamp = read_geometry (
59
59
surf_path , read_metadata = True , read_stamp = True )
60
60
61
61
assert 0 == faces .min ()
62
- assert coords .shape [0 ] == faces .max () + 1
62
+ assert coords .shape [0 ] == ( faces .max () + 1 )
63
63
assert 9 == len (volume_info )
64
64
assert [2 , 0 , 20 ] == volume_info ['head' ]
65
- assert 'created by greve on Thu Jun 8 19:17:51 2006' == create_stamp
65
+ assert [ 'created by greve on Thu Jun 8 19:17:51 2006' ] == create_stamp
66
66
67
67
# Test equivalence of freesurfer- and nibabel-generated triangular files
68
68
# with respect to read_geometry()
@@ -121,7 +121,7 @@ def test_quad_geometry():
121
121
'bert' , 'surf' , 'lh.inflated.nofix' )
122
122
coords , faces = read_geometry (new_quad )
123
123
assert 0 == faces .min ()
124
- assert coords .shape [0 ] == faces .max () + 1
124
+ assert coords .shape [0 ] == ( faces .max () + 1 )
125
125
with InTemporaryDirectory ():
126
126
new_path = 'test'
127
127
write_geometry (new_path , coords , faces )
@@ -135,8 +135,8 @@ def test_morph_data():
135
135
"""Test IO of morphometry data file (eg. curvature)."""
136
136
curv_path = pjoin (data_path , "surf" , "%s.%s" % ("lh" , "curv" ))
137
137
curv = read_morph_data (curv_path )
138
- assert ( - 1.0 < curv .min () < 0 )
139
- assert ( 0 < curv .max () < 1.0 )
138
+ assert - 1.0 < curv .min () < 0
139
+ assert 0 < curv .max () < 1.0
140
140
with InTemporaryDirectory ():
141
141
new_path = 'test'
142
142
write_morph_data (new_path , curv )
@@ -175,18 +175,18 @@ def test_annot():
175
175
hash_ = _hash_file_content (annot_path )
176
176
177
177
labels , ctab , names = read_annot (annot_path )
178
- assert ( labels .shape == (163842 , ) )
179
- assert ( ctab .shape == (len (names ), 5 ) )
178
+ assert labels .shape == (163842 , )
179
+ assert ctab .shape == (len (names ), 5 )
180
180
181
181
labels_orig = None
182
182
if a == 'aparc' :
183
183
labels_orig , _ , _ = read_annot (annot_path , orig_ids = True )
184
184
np .testing .assert_array_equal (labels == - 1 , labels_orig == 0 )
185
185
# Handle different version of fsaverage
186
186
if hash_ == 'bf0b488994657435cdddac5f107d21e8' :
187
- assert ( np .sum (labels_orig == 0 ) == 13887 )
187
+ assert np .sum (labels_orig == 0 ) == 13887
188
188
elif hash_ == 'd4f5b7cbc2ed363ac6fcf89e19353504' :
189
- assert ( np .sum (labels_orig == 1639705 ) == 13327 )
189
+ assert np .sum (labels_orig == 1639705 ) == 13327
190
190
else :
191
191
raise RuntimeError ("Unknown freesurfer file. Please report "
192
192
"the problem to the maintainer of nibabel." )
@@ -270,7 +270,7 @@ def test_write_annot_fill_ctab():
270
270
print (labels )
271
271
with clear_and_catch_warnings () as w :
272
272
write_annot (annot_path , labels , rgbal , names , fill_ctab = False )
273
- assert (
273
+ assert (
274
274
any ('Annotation values in {} will be incorrect' .format (
275
275
annot_path ) == str (ww .message ) for ww in w ))
276
276
labels2 , rgbal2 , names2 = read_annot (annot_path , orig_ids = True )
@@ -346,13 +346,13 @@ def test_label():
346
346
label_path = pjoin (data_path , "label" , "lh.cortex.label" )
347
347
label = read_label (label_path )
348
348
# XXX : test more
349
- assert ( label .min () >= 0 )
350
- assert ( label .max () <= 163841 )
351
- assert ( label .shape [0 ] <= 163842 )
349
+ assert label .min () >= 0
350
+ assert label .max () <= 163841
351
+ assert label .shape [0 ] <= 163842
352
352
353
353
labels , scalars = read_label (label_path , True )
354
- assert (np .all (labels == label ))
355
- assert ( len (labels ) == len (scalars ) )
354
+ assert (np .all (labels == label ))
355
+ assert len (labels ) == len (scalars )
356
356
357
357
358
358
def test_write_annot_maxstruct ():
0 commit comments