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)
| 16 | |
| 17 | |
| 18 | def _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 | |
| 34 | def test_pie_like_px(): |
no test coverage detected