77import base64
88import datetime
99from plotly .express .imshow_utils import rescale_intensity
10+ from plotly .tests .b64 import _b64
1011
1112img_rgb = np .array ([[[255 , 0 , 0 ], [0 , 255 , 0 ], [0 , 0 , 255 ]]], dtype = np .uint8 )
1213img_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
187188def 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
197198def 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
209210def 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
221222def 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
231232def 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