Skip to content

Commit 6e1e1c1

Browse files
committed
small fixes
1 parent f99d926 commit 6e1e1c1

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

nibabel/freesurfer/tests/test_io.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ def test_geometry():
5151
"""Test IO of .surf"""
5252
surf_path = pjoin(data_path, "surf", "%s.%s" % ("lh", "inflated"))
5353
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
5656

5757
surf_path = pjoin(data_path, "surf", "%s.%s" % ("lh", "sphere"))
5858
coords, faces, volume_info, create_stamp = read_geometry(
5959
surf_path, read_metadata=True, read_stamp=True)
6060

6161
assert 0 == faces.min()
62-
assert coords.shape[0] == faces.max() + 1
62+
assert coords.shape[0] == (faces.max() + 1)
6363
assert 9 == len(volume_info)
6464
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
6666

6767
# Test equivalence of freesurfer- and nibabel-generated triangular files
6868
# with respect to read_geometry()
@@ -121,7 +121,7 @@ def test_quad_geometry():
121121
'bert', 'surf', 'lh.inflated.nofix')
122122
coords, faces = read_geometry(new_quad)
123123
assert 0 == faces.min()
124-
assert coords.shape[0] == faces.max() + 1
124+
assert coords.shape[0] == (faces.max() + 1)
125125
with InTemporaryDirectory():
126126
new_path = 'test'
127127
write_geometry(new_path, coords, faces)
@@ -135,8 +135,8 @@ def test_morph_data():
135135
"""Test IO of morphometry data file (eg. curvature)."""
136136
curv_path = pjoin(data_path, "surf", "%s.%s" % ("lh", "curv"))
137137
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
140140
with InTemporaryDirectory():
141141
new_path = 'test'
142142
write_morph_data(new_path, curv)
@@ -175,18 +175,18 @@ def test_annot():
175175
hash_ = _hash_file_content(annot_path)
176176

177177
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)
180180

181181
labels_orig = None
182182
if a == 'aparc':
183183
labels_orig, _, _ = read_annot(annot_path, orig_ids=True)
184184
np.testing.assert_array_equal(labels == -1, labels_orig == 0)
185185
# Handle different version of fsaverage
186186
if hash_ == 'bf0b488994657435cdddac5f107d21e8':
187-
assert(np.sum(labels_orig == 0) == 13887)
187+
assert np.sum(labels_orig == 0) == 13887
188188
elif hash_ == 'd4f5b7cbc2ed363ac6fcf89e19353504':
189-
assert(np.sum(labels_orig == 1639705) == 13327)
189+
assert np.sum(labels_orig == 1639705) == 13327
190190
else:
191191
raise RuntimeError("Unknown freesurfer file. Please report "
192192
"the problem to the maintainer of nibabel.")
@@ -270,7 +270,7 @@ def test_write_annot_fill_ctab():
270270
print(labels)
271271
with clear_and_catch_warnings() as w:
272272
write_annot(annot_path, labels, rgbal, names, fill_ctab=False)
273-
assert(
273+
assert (
274274
any('Annotation values in {} will be incorrect'.format(
275275
annot_path) == str(ww.message) for ww in w))
276276
labels2, rgbal2, names2 = read_annot(annot_path, orig_ids=True)
@@ -346,13 +346,13 @@ def test_label():
346346
label_path = pjoin(data_path, "label", "lh.cortex.label")
347347
label = read_label(label_path)
348348
# 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
352352

353353
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)
356356

357357

358358
def test_write_annot_maxstruct():

nibabel/freesurfer/tests/test_mghformat.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626

2727
import pytest
2828

29-
from numpy.testing import (assert_array_equal,
30-
assert_array_almost_equal, assert_almost_equal)
29+
from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_almost_equal)
3130

3231

3332
from ...testing_pytest import data_path

0 commit comments

Comments
 (0)