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

Skip to content

Commit d3ca7e2

Browse files
committed
Add tests for _repr_png_ and _repr_html_.
1 parent d62cd55 commit d3ca7e2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,3 +1135,16 @@ def test_hex_shorthand_notation():
11351135
def test_DivergingNorm_deprecated():
11361136
with pytest.warns(cbook.MatplotlibDeprecationWarning):
11371137
norm = mcolors.DivergingNorm(vcenter=0)
1138+
1139+
1140+
def test_repr_png():
1141+
cmap = plt.get_cmap('viridis')
1142+
png = cmap._repr_png_()
1143+
assert len(png) > 0
1144+
1145+
1146+
def test_repr_html():
1147+
cmap = plt.get_cmap('viridis')
1148+
html = cmap._repr_html_()
1149+
assert len(html) > 0
1150+
assert cmap.name in html

0 commit comments

Comments
 (0)