Skip to content

Commit bb549fb

Browse files
DimitriPapadopouloseffigies
authored andcommitted
STY: Apply ruff/flake8-pytest-style rule PT027
PT027 Use `pytest.raises` instead of unittest-style `assertRaises`
1 parent 341d6d7 commit bb549fb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nibabel/streamlines/tests/test_streamlines.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ def test_save_tractogram_file(self):
191191
trk_file = trk.TrkFile(tractogram)
192192

193193
# No need for keyword arguments.
194-
with self.assertRaises(ValueError):
194+
with pytest.raises(ValueError):
195195
nib.streamlines.save(trk_file, 'dummy.trk', header={})
196196

197197
# Wrong extension.
198198
with pytest.warns(ExtensionWarning, match='extension'):
199199
trk_file = trk.TrkFile(tractogram)
200-
with self.assertRaises(ValueError):
200+
with pytest.raises(ValueError):
201201
nib.streamlines.save(trk_file, 'dummy.tck', header={})
202202

203203
with InTemporaryDirectory():
@@ -272,11 +272,11 @@ def test_save_sliced_tractogram(self):
272272
assert_tractogram_equal(tractogram, original_tractogram)
273273

274274
def test_load_unknown_format(self):
275-
with self.assertRaises(ValueError):
275+
with pytest.raises(ValueError):
276276
nib.streamlines.load('')
277277

278278
def test_save_unknown_format(self):
279-
with self.assertRaises(ValueError):
279+
with pytest.raises(ValueError):
280280
nib.streamlines.save(Tractogram(), '')
281281

282282
def test_save_from_generator(self):

0 commit comments

Comments
 (0)