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

Function test_repr_mimebundle

tests/test_io/test_renderers.py:358–376  ·  view source on GitHub ↗
(renderer_str)

Source from the content-addressed store, hash-verified

356
357@pytest.mark.parametrize("renderer_str", all_renderers_without_orca)
358def test_repr_mimebundle(renderer_str):
359 pio.renderers.default = renderer_str
360 fig = go.Figure()
361 fig.update_layout(template=None)
362 bundle = fig._repr_mimebundle_()
363 renderer = pio.renderers[renderer_str]
364 from plotly.io._renderers import MimetypeRenderer
365
366 if isinstance(renderer, MimetypeRenderer):
367 ref_bundle = renderer.to_mimebundle(fig.to_dict())
368 for key in bundle:
369 if "getElementById" in bundle[key]:
370 id1 = bundle[key].split('document.getElementById("')[1].split('")')[0]
371 id2 = (
372 ref_bundle[key].split('document.getElementById("')[1].split('")')[0]
373 )
374 assert bundle[key].replace(id1, "") == ref_bundle[key].replace(id2, "")
375 else:
376 assert bundle == {}
377
378
379def test_repr_mimebundle_mixed_renderer(fig1):

Callers

nothing calls this directly

Calls 6

update_layoutMethod · 0.95
to_dictMethod · 0.80
_repr_mimebundle_Method · 0.45
to_mimebundleMethod · 0.45
splitMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected