Skip to content

Commit e4a8d1c

Browse files
DimitriPapadopouloseffigies
authored andcommitted
STY: Apply ruff/flake8-pytest-style rule PT017
PT017 Found assertion on exception `err` in `except` block, use `pytest.raises()` instead
1 parent 30cba2c commit e4a8d1c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

nibabel/tests/test_tripwire.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ def test_tripwire():
1616
with pytest.raises(TripWireError):
1717
silly_module_name.do_silly_thing
1818
# Check AttributeError can be checked too
19-
try:
19+
with pytest.raises(AttributeError) as err:
2020
silly_module_name.__wrapped__
21-
except TripWireError as err:
22-
assert isinstance(err, AttributeError)
23-
else:
24-
raise RuntimeError('No error raised, but expected')
21+
assert isinstance(err.value, AttributeError)

0 commit comments

Comments
 (0)