Skip to content

Commit 5df8906

Browse files
committed
make test compatible with coverage reporting
1 parent d6e6d31 commit 5df8906

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

tests/test_pyvista_utils.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sme_contrib.pyvista_utils as pvu
1+
import sme_contrib as smeplots
22
import numpy as np
33
import matplotlib.pyplot as plt
44
import matplotlib.colors as mcolors
@@ -12,22 +12,22 @@ def test_rgb_to_scalar():
1212
[[[0, 0, 0], [255, 255, 255]], [[0, 0, 0], [255, 255, 255]]],
1313
]
1414
)
15-
scalar_img = pvu.rgb_to_scalar(img)
15+
scalar_img = smeplots.pyvista_utils.rgb_to_scalar(img)
1616
assert scalar_img.shape == (3, 2, 2)
1717
assert np.all(
1818
scalar_img == np.array([[[0, 1], [0, 1]], [[0, 1], [0, 1]], [[0, 1], [0, 1]]])
1919
)
2020

2121

2222
def test_make_discrete_colormap():
23-
lt = pvu.make_discrete_colormap()
23+
lt = smeplots.pyvista_utils.make_discrete_colormap()
2424
cm = plt.get_cmap("tab10").colors
2525
should = (np.array([mcolors.to_rgba(cm[0])]) * 255).astype(np.int32)
2626
assert lt.n_values == 1
2727
assert lt.scalar_range == (0, 1)
2828
assert np.all(lt.values == should)
2929

30-
lt = pvu.make_discrete_colormap("tab20", np.array([0, 1, 2, 3]))
30+
lt = smeplots.pyvista_utils.make_discrete_colormap("tab20", np.array([0, 1, 2, 3]))
3131
assert lt.n_values == 4
3232
assert lt.scalar_range == (0, 4)
3333
cm = plt.get_cmap("tab20").colors
@@ -46,18 +46,18 @@ def test_make_discrete_colormap():
4646

4747

4848
def test_find_layout():
49-
assert pvu.find_layout(1) == (1, 1)
50-
assert pvu.find_layout(3) == (1, 3)
51-
assert pvu.find_layout(5) == (2, 3)
52-
assert pvu.find_layout(8) == (2, 4)
53-
assert pvu.find_layout(10) == (2, 5)
54-
assert pvu.find_layout(15) == (3, 5)
55-
assert pvu.find_layout(15, portrait=True) == (5, 3)
56-
assert pvu.find_layout(16) == (4, 4)
57-
assert pvu.find_layout(19) == (4, 5)
58-
assert pvu.find_layout(23) == (4, 6)
59-
assert pvu.find_layout(25) == (5, 5)
60-
assert pvu.find_layout(27) == (4, 7)
61-
assert pvu.find_layout(29) == (5, 6)
62-
assert pvu.find_layout(31) == (5, 7)
63-
assert pvu.find_layout(31, portrait=True) == (7, 5)
49+
assert smeplots.pyvista_utils.find_layout(1) == (1, 1)
50+
assert smeplots.pyvista_utils.find_layout(3) == (1, 3)
51+
assert smeplots.pyvista_utils.find_layout(5) == (2, 3)
52+
assert smeplots.pyvista_utils.find_layout(8) == (2, 4)
53+
assert smeplots.pyvista_utils.find_layout(10) == (2, 5)
54+
assert smeplots.pyvista_utils.find_layout(15) == (3, 5)
55+
assert smeplots.pyvista_utils.find_layout(15, portrait=True) == (5, 3)
56+
assert smeplots.pyvista_utils.find_layout(16) == (4, 4)
57+
assert smeplots.pyvista_utils.find_layout(19) == (4, 5)
58+
assert smeplots.pyvista_utils.find_layout(23) == (4, 6)
59+
assert smeplots.pyvista_utils.find_layout(25) == (5, 5)
60+
assert smeplots.pyvista_utils.find_layout(27) == (4, 7)
61+
assert smeplots.pyvista_utils.find_layout(29) == (5, 6)
62+
assert smeplots.pyvista_utils.find_layout(31) == (5, 7)
63+
assert smeplots.pyvista_utils.find_layout(31, portrait=True) == (7, 5)

0 commit comments

Comments
 (0)