Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9d46338

Browse filesBrowse files
committed
Enforce stricter tests for _repr_png_.
1 parent a490278 commit 9d46338
Copy full SHA for 9d46338

File tree

Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed

‎lib/matplotlib/tests/test_colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colors.py
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import copy
22
import itertools
33

4+
from io import BytesIO
45
import numpy as np
6+
from PIL import Image
57
import pytest
68

79
from numpy.testing import assert_array_equal, assert_array_almost_equal
@@ -1141,6 +1143,13 @@ def test_repr_png():
11411143
cmap = plt.get_cmap('viridis')
11421144
png = cmap._repr_png_()
11431145
assert len(png) > 0
1146+
img = Image.open(BytesIO(png))
1147+
assert img.width > 0
1148+
assert img.height > 0
1149+
assert 'Title' in img.text
1150+
assert 'Description' in img.text
1151+
assert 'Author' in img.text
1152+
assert 'Software' in img.text
11441153

11451154

11461155
def test_repr_html():

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.