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

Skip to content

Commit 2a1fd21

Browse files
committed
Add masked value formatting test
1 parent e9be828 commit 2a1fd21

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_image.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,3 +1103,15 @@ def test_respects_bbox():
11031103
buf_after = io.BytesIO()
11041104
fig.savefig(buf_after, format="rgba")
11051105
assert buf_before.getvalue() != buf_after.getvalue() # Not all white.
1106+
1107+
1108+
def test_image_cursor_formatting():
1109+
fig, ax = plt.subplots()
1110+
# Create a dummy image to be able to call format_cursor_data
1111+
im = ax.imshow(np.zeros((4, 4)))
1112+
1113+
data = np.ma.masked_array([0], mask=[True])
1114+
assert im.format_cursor_data(data) == '[]'
1115+
1116+
data = np.ma.masked_array([0], mask=[False])
1117+
assert im.format_cursor_data(data) == '[0]'

0 commit comments

Comments
 (0)