File: test_without_matplotlib.py

package info (click to toggle)
iminuit 2.30.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,660 kB
  • sloc: cpp: 14,591; python: 11,177; makefile: 11; sh: 5
file content (18 lines) | stat: -rw-r--r-- 456 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from iminuit import cost
from iminuit._hide_modules import hide_modules
import pytest

pytest.importorskip("matplotlib.pyplot")


def test_visualize():
    import iminuit

    c = cost.LeastSquares([1, 2], [3, 4], 1, lambda x, a: a * x)

    s = iminuit.Minuit(c, 1).migrad()._repr_html_()
    assert "<svg" in s

    with hide_modules("matplotlib", reload="iminuit"):
        s = iminuit.Minuit(c, 1).migrad()._repr_html_()
        assert "<svg" not in s