| 1 | import matplotlib.pyplot as plt |
| 2 | import numpy as np |
| 3 | |
| 4 | import imgviz |
| 5 | |
| 6 | |
| 7 | def test_pyplot(): |
| 8 | backend = plt.get_backend() |
| 9 | plt.switch_backend("agg") |
| 10 | |
| 11 | x = y = [0, 1, 2] |
| 12 | plt.plot(x, y) |
| 13 | |
| 14 | plt.switch_backend(backend) |
| 15 | |
| 16 | img = imgviz.io.pyplot_to_numpy() |
| 17 | assert isinstance(img, np.ndarray) |
| 18 | assert img.ndim == 3 |