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

Function _compare_figures

tests/test_optional/test_px/test_px_functions.py:18–31  ·  view source on GitHub ↗

Compare a figure created with a go trace and a figure created with a px function call. Check that all values inside the go Figure are the same in the px figure (which sets more parameters).

(go_trace, px_fig)

Source from the content-addressed store, hash-verified

16
17
18def _compare_figures(go_trace, px_fig):
19 """Compare a figure created with a go trace and a figure created with
20 a px function call. Check that all values inside the go Figure are the
21 same in the px figure (which sets more parameters).
22 """
23 go_fig = go.Figure(go_trace)
24 go_fig = go_fig.to_plotly_json()
25 px_fig = px_fig.to_plotly_json()
26 del go_fig["layout"]["template"]
27 del px_fig["layout"]["template"]
28 for key in go_fig["data"][0]:
29 assert_array_equal(go_fig["data"][0][key], px_fig["data"][0][key])
30 for key in go_fig["layout"]:
31 assert go_fig["layout"][key] == px_fig["layout"][key]
32
33
34def test_pie_like_px():

Callers 2

test_pie_like_pxFunction · 0.85

Calls 1

to_plotly_jsonMethod · 0.45

Tested by

no test coverage detected