Skip to content

Commit 51016a7

Browse files
committed
Update test_tractogram.py
1 parent 4fa17af commit 51016a7

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

nibabel/streamlines/tests/test_tractogram.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -603,20 +603,15 @@ def test_tractogram_copy(self):
603603

604604
# Check we copied the data and not simply created new references.
605605
assert tractogram is not DATA['tractogram']
606-
assert tractogram.streamlines is \
607-
not DATA['tractogram'].streamlines
608-
assert tractogram.data_per_streamline is \
609-
not DATA['tractogram'].data_per_streamline
610-
assert tractogram.data_per_point is \
611-
not DATA['tractogram'].data_per_point
606+
assert tractogram.streamlines is not DATA['tractogram'].streamlines
607+
assert tractogram.data_per_streamline is not DATA['tractogram'].data_per_streamline
608+
assert tractogram.data_per_point is not DATA['tractogram'].data_per_point
612609

613610
for key in tractogram.data_per_streamline:
614-
assert tractogram.data_per_streamline[key] is \
615-
not DATA['tractogram'].data_per_streamline[key]
611+
assert tractogram.data_per_streamline[key] is not DATA['tractogram'].data_per_streamline[key]
616612

617613
for key in tractogram.data_per_point:
618-
assert tractogram.data_per_point[key] is \
619-
not DATA['tractogram'].data_per_point[key]
614+
assert tractogram.data_per_point[key] is not DATA['tractogram'].data_per_point[key]
620615

621616
# Check the values of the data are the same.
622617
assert_tractogram_equal(tractogram, DATA['tractogram'])
@@ -818,8 +813,14 @@ def test_lazy_tractogram_creation(self):
818813
# function.
819814
with pytest.raises(TypeError):
820815
LazyTractogram(streamlines=streamlines)
816+
817+
with pytest.raises(TypeError):
821818
LazyTractogram(data_per_point={"none": None})
819+
820+
with pytest.raises(TypeError):
822821
LazyTractogram(data_per_streamline=data_per_streamline)
822+
823+
with pytest.raises(TypeError):
823824
LazyTractogram(streamlines=DATA['streamlines'],
824825
data_per_point=data_per_point)
825826

@@ -833,8 +834,8 @@ def test_lazy_tractogram_creation(self):
833834
DATA['data_per_streamline_func'],
834835
DATA['data_per_point_func'])
835836

836-
assert is_lazy_dict(tractogram.data_per_streamline) is True
837-
assert is_lazy_dict(tractogram.data_per_point) is True
837+
assert is_lazy_dict(tractogram.data_per_streamline)
838+
assert is_lazy_dict(tractogram.data_per_point)
838839

839840
[t for t in tractogram] # Force iteration through tractogram.
840841
assert len(tractogram) == len(DATA['streamlines'])
@@ -1010,15 +1011,12 @@ def test_lazy_tractogram_copy(self):
10101011

10111012
# When copying LazyTractogram, the generator function yielding
10121013
# streamlines should stay the same.
1013-
assert tractogram._streamlines \
1014-
is DATA['lazy_tractogram']._streamlines
1014+
assert tractogram._streamlines is DATA['lazy_tractogram']._streamlines
10151015

10161016
# Copying LazyTractogram, creates new internal LazyDict objects,
10171017
# but generator functions contained in it should stay the same.
1018-
assert tractogram._data_per_streamline \
1019-
is not DATA['lazy_tractogram']._data_per_streamline
1020-
assert tractogram._data_per_point \
1021-
is not DATA['lazy_tractogram']._data_per_point
1018+
assert tractogram._data_per_streamline is not DATA['lazy_tractogram']._data_per_streamline
1019+
assert tractogram._data_per_point is not DATA['lazy_tractogram']._data_per_point
10221020

10231021
for key in tractogram.data_per_streamline:
10241022
data = tractogram.data_per_streamline.store[key]
@@ -1031,8 +1029,7 @@ def test_lazy_tractogram_copy(self):
10311029
assert data is expected
10321030

10331031
# The affine should be a copy.
1034-
assert tractogram._affine_to_apply \
1035-
is not DATA['lazy_tractogram']._affine_to_apply
1032+
assert tractogram._affine_to_apply is not DATA['lazy_tractogram']._affine_to_apply
10361033
assert_array_equal(tractogram._affine_to_apply,
10371034
DATA['lazy_tractogram']._affine_to_apply)
10381035

0 commit comments

Comments
 (0)