Skip to content

Commit

Permalink
fix: adjust tests for mpl
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejnovak committed Feb 3, 2025
1 parent a6dc1ab commit e1e20c4
Show file tree
Hide file tree
Showing 3 changed files with 16 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.
16 changes: 16 additions & 0 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from __future__ import annotations

import os
import sys
import re

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


@pytest.mark.skipif(matplotlib.__version__ >= '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(matplotlib.__version__ < '3.10', reason="Change in mpl behaviour since 3.10")

Check failure on line 77 in tests/test_basic.py

View workflow job for this annotation

GitHub Actions / 🐍 3.8 • ubuntu-latest

test_log Failed: Error: Image files did not match. RMS Value: 6.5155241283159 Expected: /home/runner/work/mplhep/mplhep/pytest_results/test_basic.test_log/baseline.png Actual: /home/runner/work/mplhep/mplhep/pytest_results/test_basic.test_log/result.png Difference: /home/runner/work/mplhep/mplhep/pytest_results/test_basic.test_log/result-failed-diff.png Tolerance: 2

Check failure on line 77 in tests/test_basic.py

View workflow job for this annotation

GitHub Actions / 🐍 3.9 • macOS-13

test_log Failed: Error: Image files did not match. RMS Value: 6.5155241283159 Expected: /Users/runner/work/mplhep/mplhep/pytest_results/test_basic.test_log/baseline.png Actual: /Users/runner/work/mplhep/mplhep/pytest_results/test_basic.test_log/result.png Difference: /Users/runner/work/mplhep/mplhep/pytest_results/test_basic.test_log/result-failed-diff.png Tolerance: 2
@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 e1e20c4

Please sign in to comment.