@@ -92,16 +92,12 @@ def test_geometry():
92
92
warnings .filterwarnings ('always' , category = DeprecationWarning )
93
93
read_geometry (surf_path , read_metadata = True )
94
94
95
- assert (
96
- any ('volume information contained' in str (ww .message )
97
- for ww in w ))
98
- assert (
99
- any ('extension code' in str (ww .message ) for ww in w ))
95
+ assert any ('volume information contained' in str (ww .message ) for ww in w )
96
+ assert any ('extension code' in str (ww .message ) for ww in w )
100
97
volume_info ['head' ] = [1 , 2 ]
101
98
with clear_and_catch_warnings () as w :
102
99
write_geometry (surf_path , coords , faces , create_stamp , volume_info )
103
- assert (
104
- any ('Unknown extension' in str (ww .message ) for ww in w ))
100
+ assert any ('Unknown extension' in str (ww .message ) for ww in w )
105
101
volume_info ['a' ] = 0
106
102
with pytest .raises (ValueError ):
107
103
write_geometry (surf_path , coords , faces , create_stamp , volume_info )
@@ -146,7 +142,7 @@ def test_morph_data():
146
142
new_path = 'test'
147
143
write_morph_data (new_path , curv )
148
144
curv2 = read_morph_data (new_path )
149
- assert np .array_equal (curv2 , curv )
145
+ assert np .array_equal (curv2 , curv )
150
146
151
147
152
148
def test_write_morph_data ():
@@ -163,7 +159,7 @@ def test_write_morph_data():
163
159
164
160
with pytest .raises (ValueError ):
165
161
write_morph_data ('test.curv' , np .zeros (shape ), big_num )
166
- # Windows 32-bit overflows Python int
162
+ # Windows 32-bit overflows Python int
167
163
if np .dtype (np .int ) != np .dtype (np .int32 ):
168
164
with pytest .raises (ValueError ):
169
165
write_morph_data ('test.curv' , strided_scalar ((big_num ,)))
@@ -272,12 +268,10 @@ def test_write_annot_fill_ctab():
272
268
# values back.
273
269
badannot = (10 * np .arange (nlabels , dtype = np .int32 )).reshape (- 1 , 1 )
274
270
rgbal = np .hstack ((rgba , badannot ))
275
- print (labels )
276
271
with clear_and_catch_warnings () as w :
277
272
write_annot (annot_path , labels , rgbal , names , fill_ctab = False )
278
- assert (
279
- any ('Annotation values in {} will be incorrect' .format (
280
- annot_path ) == str (ww .message ) for ww in w ))
273
+ assert any ('Annotation values in {} will be incorrect' .format (annot_path ) == str (ww .message )
274
+ for ww in w )
281
275
labels2 , rgbal2 , names2 = read_annot (annot_path , orig_ids = True )
282
276
names2 = [n .decode ('ascii' ) for n in names2 ]
283
277
assert np .all (np .isclose (rgbal2 [:, :4 ], rgba ))
@@ -291,9 +285,8 @@ def test_write_annot_fill_ctab():
291
285
rgbal [:, 2 ] * (2 ** 16 ))
292
286
with clear_and_catch_warnings () as w :
293
287
write_annot (annot_path , labels , rgbal , names , fill_ctab = False )
294
- assert (
295
- not any ('Annotation values in {} will be incorrect' .format (
296
- annot_path ) == str (ww .message ) for ww in w ))
288
+ assert all ('Annotation values in {} will be incorrect' .format (annot_path ) != str (ww .message )
289
+ for ww in w )
297
290
labels2 , rgbal2 , names2 = read_annot (annot_path )
298
291
names2 = [n .decode ('ascii' ) for n in names2 ]
299
292
assert np .all (np .isclose (rgbal2 [:, :4 ], rgba ))
@@ -356,7 +349,7 @@ def test_label():
356
349
assert label .shape [0 ] <= 163842
357
350
358
351
labels , scalars = read_label (label_path , True )
359
- assert ( np .all (labels == label ) )
352
+ assert np .all (labels == label )
360
353
assert len (labels ) == len (scalars )
361
354
362
355
0 commit comments