Skip to content

Commit 2b33199

Browse files
committed
adjust test_imshow.py
1 parent d1b4706 commit 2b33199

File tree

1 file changed

+7
-7
lines changed
  • packages/python/plotly/plotly/tests/test_optional/test_px

1 file changed

+7
-7
lines changed

packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import base64
88
import datetime
99
from plotly.express.imshow_utils import rescale_intensity
10+
from plotly.tests.b64 import _b64
1011

1112
img_rgb = np.array([[[255, 0, 0], [0, 255, 0], [0, 0, 255]]], dtype=np.uint8)
1213
img_gray = np.arange(100, dtype=float).reshape((10, 10))
@@ -181,7 +182,7 @@ def test_imshow_xarray(binary_string):
181182
assert fig.layout.xaxis.title.text == "dim_cols"
182183
assert fig.layout.yaxis.title.text == "dim_rows"
183184
if not binary_string:
184-
assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_cols"]))
185+
assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_cols"]))
185186

186187

187188
def test_imshow_xarray_slicethrough():
@@ -191,7 +192,7 @@ def test_imshow_xarray_slicethrough():
191192
# Dimensions are used for axis labels and coordinates
192193
assert fig.layout.xaxis.title.text == "dim_2"
193194
assert fig.layout.yaxis.title.text == "dim_1"
194-
assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_2"]))
195+
assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_2"]))
195196

196197

197198
def test_imshow_xarray_facet_col_string():
@@ -203,7 +204,7 @@ def test_imshow_xarray_facet_col_string():
203204
# Dimensions are used for axis labels and coordinates
204205
assert fig.layout.xaxis.title.text == "dim_2"
205206
assert fig.layout.yaxis.title.text == "dim_1"
206-
assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_2"]))
207+
assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_2"]))
207208

208209

209210
def test_imshow_xarray_animation_frame_string():
@@ -215,7 +216,7 @@ def test_imshow_xarray_animation_frame_string():
215216
# Dimensions are used for axis labels and coordinates
216217
assert fig.layout.xaxis.title.text == "dim_2"
217218
assert fig.layout.yaxis.title.text == "dim_1"
218-
assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_2"]))
219+
assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_2"]))
219220

220221

221222
def test_imshow_xarray_animation_facet_slicethrough():
@@ -225,7 +226,7 @@ def test_imshow_xarray_animation_facet_slicethrough():
225226
# Dimensions are used for axis labels and coordinates
226227
assert fig.layout.xaxis.title.text == "dim_3"
227228
assert fig.layout.yaxis.title.text == "dim_2"
228-
assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_3"]))
229+
assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_3"]))
229230

230231

231232
def test_imshow_labels_and_ranges():
@@ -291,8 +292,7 @@ def test_imshow_dataframe():
291292
assert fig.data[0].x[0] == df.columns[0]
292293
assert fig.data[0].x[0] == "nation"
293294
assert fig.layout.xaxis.title.text is None
294-
assert fig.data[0].y[0] == df.index[0]
295-
assert fig.data[0].y[0] == 0
295+
assert fig.data[0].y == _b64(df.index)
296296
assert fig.layout.yaxis.title.text is None
297297

298298
df = px.data.medals_wide(indexed=True)

0 commit comments

Comments
 (0)