Skip to content

Commit 2a81372

Browse files
committed
Test out of bounds
1 parent 381cacf commit 2a81372

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/matplotlib/tests/test_image.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@ def test_cursor_data():
371371
[[0.5, 1.5], 0 + 1],
372372
[[4.5, 0.5], 16 + 0],
373373
[[8.5, 0.5], 16 + 0],
374-
[[9.5, 2.5], 81 + 4]
374+
[[9.5, 2.5], 81 + 4],
375+
[[-1, 0.5], None],
376+
[[0.5, -1], None],
375377
]
376378
)
377379
def test_cursor_data_nonuniform(xy, data):
@@ -386,8 +388,9 @@ def test_cursor_data_nonuniform(xy, data):
386388
im = NonUniformImage(ax, extent=(x.min(), x.max(), y.min(), y.max()))
387389
im.set_data(x, y, z)
388390
ax.add_image(im)
389-
ax.set_xlim(x.min(), x.max())
390-
ax.set_ylim(y.min(), y.max())
391+
# Set lower min lim so we can test cursor outside image
392+
ax.set_xlim(x.min() - 2, x.max())
393+
ax.set_ylim(y.min() - 2, y.max())
391394

392395
xdisp, ydisp = ax.transData.transform(xy)
393396
event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp)

0 commit comments

Comments
 (0)