Skip to content

Commit ec5e150

Browse files
authored
fix: update test for new mpl behaviour (#542)
* fix: adjust tests for mpl * fix: adjust tests for mpl, ruff * fix: version parsin
1 parent a6dc1ab commit ec5e150

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

tests/baseline/test_log.png

87 Bytes
Loading

tests/baseline/test_log_mpl39.png

8.52 KB
Loading

tests/test_basic.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import re
55

66
import hist
7+
import matplotlib as mpl
78
import matplotlib.pyplot as plt
89
import numpy as np
910
import pytest
@@ -59,6 +60,26 @@ def test_simple2d():
5960
return fig
6061

6162

63+
@pytest.mark.skipif(
64+
(int(mpl.__version__.split(".")[0]), int(mpl.__version__.split(".")[1])) >= (3, 10),
65+
reason="Change in mpl behaviour since 3.10",
66+
)
67+
@pytest.mark.mpl_image_compare(style="default", remove_text=True)
68+
def test_log_mpl39():
69+
fig, axs = plt.subplots(2, 2, figsize=(10, 10))
70+
for ax in axs[0]:
71+
hep.histplot([1, 2, 3, 2], range(5), ax=ax)
72+
ax.semilogy()
73+
for ax in axs[1]:
74+
hep.histplot([1, 2, 3, 2], range(5), ax=ax, edges=False)
75+
ax.semilogy()
76+
return fig
77+
78+
79+
@pytest.mark.skipif(
80+
(int(mpl.__version__.split(".")[0]), int(mpl.__version__.split(".")[1])) < (3, 10),
81+
reason="Change in mpl behaviour since 3.10",
82+
)
6283
@pytest.mark.mpl_image_compare(style="default", remove_text=True)
6384
def test_log():
6485
fig, axs = plt.subplots(2, 2, figsize=(10, 10))

0 commit comments

Comments
 (0)