File: test_pyplot.py

package info (click to toggle)
python-imgviz 1.2.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,268 kB
  • sloc: python: 3,032; makefile: 15
file content (18 lines) | stat: -rw-r--r-- 327 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import matplotlib.pyplot as plt
import numpy as np

import imgviz


def test_pyplot():
    backend = plt.get_backend()
    plt.switch_backend("agg")

    x = y = [0, 1, 2]
    plt.plot(x, y)

    plt.switch_backend(backend)

    img = imgviz.io.pyplot_to_numpy()
    assert isinstance(img, np.ndarray)
    assert img.ndim == 3