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

Skip to content

Commit 438923f

Browse files
committed
test _repr_png_() for MultivarColormap
1 parent b73adcf commit 438923f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/matplotlib/tests/test_multivariate_colormaps.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,19 @@ def test_bivariate_repr_html():
478478
assert html.endswith('</div>')
479479

480480

481+
def test_multivariate_repr_png():
482+
cmap = mpl.multivar_colormaps['3VarAddA']
483+
png = cmap._repr_png_()
484+
assert len(png) > 0
485+
img = Image.open(BytesIO(png))
486+
assert img.width > 0
487+
assert img.height > 0
488+
assert 'Title' in img.text
489+
assert 'Description' in img.text
490+
assert 'Author' in img.text
491+
assert 'Software' in img.text
492+
493+
481494
def test_multivariate_repr_html():
482495
cmap = mpl.multivar_colormaps['3VarAddA']
483496
html = cmap._repr_html_()

0 commit comments

Comments
 (0)