Skip to content

Commit

Permalink
fix: update test for new mpl behaviour (#542)
Browse files Browse the repository at this point in the history
* fix: adjust tests for mpl

* fix: adjust tests for mpl, ruff

* fix: version parsin
  • Loading branch information
andrzejnovak authored Feb 3, 2025
1 parent a6dc1ab commit ec5e150
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Binary file modified tests/baseline/test_log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/baseline/test_log_mpl39.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re

import hist
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pytest
Expand Down Expand Up @@ -59,6 +60,26 @@ def test_simple2d():
return fig


@pytest.mark.skipif(
(int(mpl.__version__.split(".")[0]), int(mpl.__version__.split(".")[1])) >= (3, 10),
reason="Change in mpl behaviour since 3.10",
)
@pytest.mark.mpl_image_compare(style="default", remove_text=True)
def test_log_mpl39():
fig, axs = plt.subplots(2, 2, figsize=(10, 10))
for ax in axs[0]:
hep.histplot([1, 2, 3, 2], range(5), ax=ax)
ax.semilogy()
for ax in axs[1]:
hep.histplot([1, 2, 3, 2], range(5), ax=ax, edges=False)
ax.semilogy()
return fig


@pytest.mark.skipif(
(int(mpl.__version__.split(".")[0]), int(mpl.__version__.split(".")[1])) < (3, 10),
reason="Change in mpl behaviour since 3.10",
)
@pytest.mark.mpl_image_compare(style="default", remove_text=True)
def test_log():
fig, axs = plt.subplots(2, 2, figsize=(10, 10))
Expand Down

0 comments on commit ec5e150

Please sign in to comment.