Skip to content

Commit d3410ee

Browse files
committed
PEP8
1 parent 09f4ed6 commit d3410ee

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

nibabel/streamlines/tests/test_tractogram.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,13 @@ def setup():
127127
affine_to_rasmm=np.eye(4))
128128

129129
DATA['streamlines_func'] = lambda: (e for e in DATA['streamlines'])
130-
fa_func = lambda: (e for e in DATA['fa'])
131-
colors_func = lambda: (e for e in DATA['colors'])
132-
mean_curvature_func = lambda: (e for e in DATA['mean_curvature'])
133-
mean_torsion_func = lambda: (e for e in DATA['mean_torsion'])
134-
mean_colors_func = lambda: (e for e in DATA['mean_colors'])
135-
136-
DATA['data_per_point_func'] = {'colors': colors_func,
137-
'fa': fa_func}
138-
DATA['data_per_streamline_func'] = {'mean_curvature': mean_curvature_func,
139-
'mean_torsion': mean_torsion_func,
140-
'mean_colors': mean_colors_func}
130+
DATA['data_per_point_func'] = {
131+
'colors': lambda: (e for e in DATA['colors']),
132+
'fa': lambda: (e for e in DATA['fa'])}
133+
DATA['data_per_streamline_func'] = {
134+
'mean_curvature': lambda: (e for e in DATA['mean_curvature']),
135+
'mean_torsion': lambda: (e for e in DATA['mean_torsion']),
136+
'mean_colors': lambda: (e for e in DATA['mean_colors'])}
141137

142138
DATA['lazy_tractogram'] = LazyTractogram(DATA['streamlines_func'],
143139
DATA['data_per_streamline_func'],
@@ -742,8 +738,8 @@ def test_lazy_tractogram_creation(self):
742738
# Streamlines and other data as generators
743739
streamlines = (x for x in DATA['streamlines'])
744740
data_per_point = {"colors": (x for x in DATA['colors'])}
745-
data_per_streamline = {'mean_torsion': (x for x in DATA['mean_torsion']),
746-
'mean_colors': (x for x in DATA['mean_colors'])}
741+
data_per_streamline = {'torsion': (x for x in DATA['mean_torsion']),
742+
'colors': (x for x in DATA['mean_colors'])}
747743

748744
# Creating LazyTractogram with generators is not allowed as
749745
# generators get exhausted and are not reusable unlike generator
@@ -773,9 +769,7 @@ def test_lazy_tractogram_creation(self):
773769

774770
def test_lazy_tractogram_from_data_func(self):
775771
# Create an empty `LazyTractogram` yielding nothing.
776-
_empty_data_gen = lambda: iter([])
777-
778-
tractogram = LazyTractogram.from_data_func(_empty_data_gen)
772+
tractogram = LazyTractogram.from_data_func(lambda: iter([]))
779773
check_tractogram(tractogram)
780774

781775
# Create `LazyTractogram` from a generator function yielding
@@ -930,12 +924,14 @@ def test_lazy_tractogram_copy(self):
930924
is not DATA['lazy_tractogram']._data_per_point)
931925

932926
for key in tractogram.data_per_streamline:
933-
assert_true(tractogram.data_per_streamline.store[key]
934-
is DATA['lazy_tractogram'].data_per_streamline.store[key])
927+
data = tractogram.data_per_streamline.store[key]
928+
expected = DATA['lazy_tractogram'].data_per_streamline.store[key]
929+
assert_true(data is expected)
935930

936931
for key in tractogram.data_per_point:
937-
assert_true(tractogram.data_per_point.store[key]
938-
is DATA['lazy_tractogram'].data_per_point.store[key])
932+
data = tractogram.data_per_point.store[key]
933+
expected = DATA['lazy_tractogram'].data_per_point.store[key]
934+
assert_true(data is expected)
939935

940936
# The affine should be a copy.
941937
assert_true(tractogram._affine_to_apply

nibabel/streamlines/tractogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def extend(self, other):
496496
Notes
497497
-----
498498
The entries in both dictionaries `self.data_per_streamline` and
499-
`self.data_per_point` must match respectively those contained in the .
499+
`self.data_per_point` must match respectively those contained in
500500
the other tractogram.
501501
"""
502502
self.streamlines.extend(other.streamlines)

0 commit comments

Comments
 (0)