|
6 | 6 | from pandas.testing import assert_frame_equal |
7 | 7 | import pytest |
8 | 8 | import warnings |
| 9 | +from plotly.tests.b64 import _b64 |
9 | 10 |
|
10 | 11 |
|
11 | 12 | def test_is_col_list(): |
@@ -73,34 +74,34 @@ def test_wide_mode_external(px_fn, orientation, style): |
73 | 74 | if style == "explicit": |
74 | 75 | fig = px_fn(**{"data_frame": df, y: list(df.columns), x: df.index}) |
75 | 76 | assert len(fig.data) == 3 |
76 | | - assert list(fig.data[0][x]) == [11, 12, 13] |
77 | | - assert list(fig.data[0][y]) == [1, 2, 3] |
78 | | - assert list(fig.data[1][x]) == [11, 12, 13] |
79 | | - assert list(fig.data[1][y]) == [4, 5, 6] |
| 77 | + assert fig.data[0][x] == _b64([11, 12, 13]) |
| 78 | + assert fig.data[0][y] == _b64([1, 2, 3]) |
| 79 | + assert fig.data[1][x] == _b64([11, 12, 13]) |
| 80 | + assert fig.data[1][y] == _b64([4, 5, 6]) |
80 | 81 | assert fig.layout[xaxis].title.text == "index" |
81 | 82 | assert fig.layout[yaxis].title.text == "value" |
82 | 83 | assert fig.layout.legend.title.text == "variable" |
83 | 84 | if px_fn in [px.density_heatmap]: |
84 | 85 | if style == "explicit": |
85 | 86 | fig = px_fn(**{"data_frame": df, y: list(df.columns), x: df.index}) |
86 | 87 | assert len(fig.data) == 1 |
87 | | - assert list(fig.data[0][x]) == [11, 12, 13, 11, 12, 13, 11, 12, 13] |
88 | | - assert list(fig.data[0][y]) == [1, 2, 3, 4, 5, 6, 7, 8, 9] |
| 88 | + assert fig.data[0][x] == _b64([11, 12, 13, 11, 12, 13, 11, 12, 13]) |
| 89 | + assert fig.data[0][y] == _b64([1, 2, 3, 4, 5, 6, 7, 8, 9]) |
89 | 90 | assert fig.layout[xaxis].title.text == "index" |
90 | 91 | assert fig.layout[yaxis].title.text == "value" |
91 | 92 | if px_fn in [px.violin, px.box, px.strip]: |
92 | 93 | if style == "explicit": |
93 | 94 | fig = px_fn(**{"data_frame": df, y: list(df.columns)}) |
94 | 95 | assert len(fig.data) == 1 |
95 | 96 | assert list(fig.data[0][x]) == ["a"] * 3 + ["b"] * 3 + ["c"] * 3 |
96 | | - assert list(fig.data[0][y]) == list(range(1, 10)) |
| 97 | + assert fig.data[0][y] == _b64(range(1, 10)) |
97 | 98 | assert fig.layout[yaxis].title.text == "value" |
98 | 99 | assert fig.layout[xaxis].title.text == "variable" |
99 | 100 | if px_fn in [px.histogram]: |
100 | 101 | if style == "explicit": |
101 | 102 | fig = px_fn(**{"data_frame": df, x: list(df.columns)}) |
102 | 103 | assert len(fig.data) == 3 |
103 | | - assert list(fig.data[1][x]) == [4, 5, 6] |
| 104 | + assert fig.data[1][x] == _b64([4, 5, 6]) |
104 | 105 | assert fig.layout.legend.title.text == "variable" |
105 | 106 | assert fig.layout[xaxis].title.text == "value" |
106 | 107 |
|
|
0 commit comments