MCPcopy Create free account
hub / github.com/plotly/plotly.py / test_image_renderer

Function test_image_renderer

tests/test_optional/test_kaleido/test_kaleido.py:142–159  ·  view source on GitHub ↗

Verify that the image renderer returns the expected mimebundle.

()

Source from the content-addressed store, hash-verified

140
141
142def test_image_renderer():
143 """Verify that the image renderer returns the expected mimebundle."""
144 with redirect_stdout(StringIO()) as f:
145 pio.show(fig, renderer="png", engine="kaleido", validate=False)
146 mimebundle = f.getvalue().strip()
147 mimebundle_expected = str(
148 {
149 "image/png": base64.b64encode(
150 pio.to_image(
151 fig,
152 format="png",
153 engine="kaleido",
154 validate=False,
155 )
156 ).decode("utf8")
157 }
158 )
159 assert mimebundle == mimebundle_expected
160
161
162def test_bytesio():

Callers

nothing calls this directly

Calls 3

to_imageMethod · 0.80
showMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected