Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e78f65

Browse files
committed
More smoketesting of pcolorfast.
1 parent daaf978 commit 6e78f65

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import warnings
1717

1818
import matplotlib
19+
import matplotlib as mpl
1920
from matplotlib.testing.decorators import (
2021
image_comparison, check_figures_equal, remove_ticks_and_titles)
2122
import matplotlib.pyplot as plt
@@ -5220,14 +5221,21 @@ def test_no_None():
52205221
plt.plot(None, None)
52215222

52225223

5223-
def test_pcolor_fast_non_uniform():
5224-
Z = np.arange(6).reshape((3, 2))
5225-
X = np.array([0, 1, 2, 10])
5226-
Y = np.array([0, 1, 2])
5227-
5228-
plt.figure()
5229-
ax = plt.subplot(111)
5230-
ax.pcolorfast(X, Y, Z.T)
5224+
@pytest.mark.parametrize(
5225+
"xy, cls", [
5226+
((), mpl.image.AxesImage), # (0, N)
5227+
(((3, 7), (2, 6)), mpl.image.AxesImage), # (xmin, xmax)
5228+
((range(5), range(4)), mpl.image.AxesImage), # regular grid
5229+
(([1, 2, 4, 8, 16], [0, 1, 2, 3]), # irregular grid
5230+
mpl.image.PcolorImage),
5231+
((np.random.random((4, 5)), np.random.random((4, 5))), # 2D coords
5232+
mpl.collections.QuadMesh),
5233+
]
5234+
)
5235+
def test_pcolorfast_colormapped(xy, cls):
5236+
fig, ax = plt.subplots()
5237+
data = np.arange(12).reshape((3, 4))
5238+
assert type(ax.pcolorfast(*xy, data)) == cls
52315239

52325240

52335241
def test_shared_scale():

0 commit comments

Comments
 (0)