Skip to content

Commit eaab253

Browse files
committed
TEST: Style and formatting
1 parent e3f171b commit eaab253

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

nibabel/freesurfer/tests/test_io.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,12 @@ def test_geometry():
9292
warnings.filterwarnings('always', category=DeprecationWarning)
9393
read_geometry(surf_path, read_metadata=True)
9494

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)
10097
volume_info['head'] = [1, 2]
10198
with clear_and_catch_warnings() as w:
10299
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)
105101
volume_info['a'] = 0
106102
with pytest.raises(ValueError):
107103
write_geometry(surf_path, coords, faces, create_stamp, volume_info)
@@ -146,7 +142,7 @@ def test_morph_data():
146142
new_path = 'test'
147143
write_morph_data(new_path, curv)
148144
curv2 = read_morph_data(new_path)
149-
assert np.array_equal (curv2, curv)
145+
assert np.array_equal(curv2, curv)
150146

151147

152148
def test_write_morph_data():
@@ -163,7 +159,7 @@ def test_write_morph_data():
163159

164160
with pytest.raises(ValueError):
165161
write_morph_data('test.curv', np.zeros(shape), big_num)
166-
# Windows 32-bit overflows Python int
162+
# Windows 32-bit overflows Python int
167163
if np.dtype(np.int) != np.dtype(np.int32):
168164
with pytest.raises(ValueError):
169165
write_morph_data('test.curv', strided_scalar((big_num,)))
@@ -272,12 +268,10 @@ def test_write_annot_fill_ctab():
272268
# values back.
273269
badannot = (10 * np.arange(nlabels, dtype=np.int32)).reshape(-1, 1)
274270
rgbal = np.hstack((rgba, badannot))
275-
print(labels)
276271
with clear_and_catch_warnings() as w:
277272
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)
281275
labels2, rgbal2, names2 = read_annot(annot_path, orig_ids=True)
282276
names2 = [n.decode('ascii') for n in names2]
283277
assert np.all(np.isclose(rgbal2[:, :4], rgba))
@@ -291,9 +285,8 @@ def test_write_annot_fill_ctab():
291285
rgbal[:, 2] * (2 ** 16))
292286
with clear_and_catch_warnings() as w:
293287
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)
297290
labels2, rgbal2, names2 = read_annot(annot_path)
298291
names2 = [n.decode('ascii') for n in names2]
299292
assert np.all(np.isclose(rgbal2[:, :4], rgba))
@@ -356,7 +349,7 @@ def test_label():
356349
assert label.shape[0] <= 163842
357350

358351
labels, scalars = read_label(label_path, True)
359-
assert (np.all(labels == label))
352+
assert np.all(labels == label)
360353
assert len(labels) == len(scalars)
361354

362355

0 commit comments

Comments
 (0)