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

Skip to content

Commit fdfeba2

Browse files
committed
TST: add a test for pcolormesh underflow
1 parent 90a3971 commit fdfeba2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,22 @@ def test_pcolorargs():
15171517
ax.pcolormesh(X, Y, Z, shading='auto')
15181518

15191519

1520+
def test_pcolormesh_underflow_error():
1521+
"""
1522+
Test that underflow errors don't crop up in pcolormesh. Probably
1523+
a numpy bug, but...
1524+
"""
1525+
oldsettings = np.geterr()
1526+
np.seterr(under="raise")
1527+
x = np.arange(0, 3, 0.1)
1528+
y = np.arange(0, 6, 0.1)
1529+
z = np.random.randn(len(y), len(x))
1530+
fig, ax = plt.subplots()
1531+
ax.pcolormesh(x, y, z)
1532+
1533+
np.seterr(**oldsettings)
1534+
1535+
15201536
def test_pcolorargs_with_read_only():
15211537
x = np.arange(6).reshape(2, 3)
15221538
xmask = np.broadcast_to([False, True, False], x.shape) # read-only array

0 commit comments

Comments
 (0)