Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski committed Oct 10, 2024
1 parent f3dddb5 commit 797d4e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/pyhepmc/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def savefig(
except ValueError:
if p.exists():
p.unlink()
raise
return

# if we arrive here, fname is a file-like object
Expand Down
6 changes: 5 additions & 1 deletion tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,17 @@ def test_savefig_1(evt, ext):
assert np.sum(a1[:size] != a2[:size]) < 150


def test_savefig_2(evt):
def test_savefig_2a(evt):
with pytest.raises(ValueError):
view.savefig(evt, "foo")


def test_savefig_2b(evt):
with pytest.raises(ValueError):
view.savefig(evt, "foo.foo")


def test_savefig_2c(evt):
with pytest.raises(ValueError):
with io.BytesIO() as f:
view.savefig(evt, f)
Expand Down

0 comments on commit 797d4e6

Please sign in to comment.