diff --git a/packages/python/plotly/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py b/packages/python/plotly/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py
index 27d91c96b1..20a1b23f7f 100644
--- a/packages/python/plotly/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py
+++ b/packages/python/plotly/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py
@@ -2,7 +2,7 @@
from plotly import optional_imports
from plotly.graph_objs import graph_objs as go
from plotly.exceptions import PlotlyError
-import pytest
+import plotly.io as pio
import plotly.figure_factory as ff
from plotly.tests.test_optional.optional_utils import NumpyTestUtilsMixin
@@ -12,8 +12,6 @@
from scipy.spatial import Delaunay
import pandas as pd
-from plotly.tests.b64 import b64, _b64
-
shapely = optional_imports.get_module("shapely")
shapefile = optional_imports.get_module("shapefile")
gp = optional_imports.get_module("geopandas")
@@ -956,7 +954,7 @@ def test_default_dendrogram(self):
),
go.Scatter(
x=np.array([15.0, 15.0, 30.0, 30.0]),
- y=np.array([0, 2.23606797749979, 2.23606797749979, 1]),
+ y=np.array([0.0, 2.23606798, 2.23606798, 1.0]),
marker=go.scatter.Marker(color="rgb(61,153,112)"),
mode="lines",
xaxis="x",
@@ -966,9 +964,7 @@ def test_default_dendrogram(self):
),
go.Scatter(
x=np.array([5.0, 5.0, 22.5, 22.5]),
- y=np.array(
- [0, 3.605551275463989, 3.605551275463989, 2.23606797749979]
- ),
+ y=np.array([0.0, 3.60555128, 3.60555128, 2.23606798]),
marker=go.scatter.Marker(color="rgb(0,116,217)"),
mode="lines",
xaxis="x",
@@ -1016,7 +1012,7 @@ def test_default_dendrogram(self):
self.assert_fig_equal(dendro["data"][1], expected_dendro["data"][1])
self.assert_fig_equal(dendro["data"][2], expected_dendro["data"][2])
- # self.assert_fig_equal(dendro["layout"], expected_dendro["layout"])
+ self.assert_fig_equal(dendro["layout"], expected_dendro["layout"])
def test_dendrogram_random_matrix(self):
@@ -1097,6 +1093,29 @@ def test_dendrogram_random_matrix(self):
self.assertEqual(len(dendro["data"]), 4)
+ # it's random, so we can only check that the values aren't equal
+ y_vals = [
+ dendro["data"][0].to_plotly_json().pop("y"),
+ dendro["data"][1].to_plotly_json().pop("y"),
+ dendro["data"][2].to_plotly_json().pop("y"),
+ dendro["data"][3].to_plotly_json().pop("y"),
+ ]
+ for i in range(len(y_vals)):
+ for j in range(len(y_vals)):
+ if i != j:
+ self.assertFalse(np.allclose(y_vals[i], y_vals[j]))
+
+ x_vals = [
+ dendro["data"][0].to_plotly_json().pop("x"),
+ dendro["data"][1].to_plotly_json().pop("x"),
+ dendro["data"][2].to_plotly_json().pop("x"),
+ dendro["data"][3].to_plotly_json().pop("x"),
+ ]
+ for i in range(len(x_vals)):
+ for j in range(len(x_vals)):
+ if i != j:
+ self.assertFalse(np.allclose(x_vals[i], x_vals[j]))
+
# we also need to check the ticktext manually
xaxis_ticktext = dendro["layout"].to_plotly_json()["xaxis"].pop("ticktext")
self.assertEqual(xaxis_ticktext[0], "John")
@@ -1177,7 +1196,7 @@ def test_dendrogram_colorscale(self):
),
go.Scatter(
x=np.array([15.0, 15.0, 30.0, 30.0]),
- y=np.array([0, 2.23606797749979, 2.23606797749979, 1]),
+ y=np.array([0.0, 2.23606798, 2.23606798, 1.0]),
marker=go.scatter.Marker(color="rgb(128,128,128)"),
mode="lines",
xaxis="x",
@@ -1187,9 +1206,7 @@ def test_dendrogram_colorscale(self):
),
go.Scatter(
x=np.array([5.0, 5.0, 22.5, 22.5]),
- y=np.array(
- [0, 3.605551275463989, 3.605551275463989, 2.23606797749979]
- ),
+ y=np.array([0.0, 3.60555128, 3.60555128, 2.23606798]),
marker=go.scatter.Marker(color="rgb(0,0,0)"),
mode="lines",
xaxis="x",
@@ -1346,9 +1363,9 @@ def test_trisurf_all_args(self):
u = u.flatten()
v = v.flatten()
- x = u.astype("i4")
- y = v.astype("i4")
- z = u * v.astype("f8")
+ x = u
+ y = v
+ z = u * v
points2D = np.vstack([u, v]).T
tri = Delaunay(points2D)
@@ -1369,26 +1386,14 @@ def test_trisurf_all_args(self):
"rgb(143, 123, 97)",
"rgb(255, 127, 14)",
],
- "i": b64(np.array([3, 1, 1, 5, 7, 3, 5, 7]).astype("i4")),
- "j": b64(np.array([1, 3, 5, 1, 3, 7, 7, 5]).astype("i4")),
- "k": b64(np.array([4, 0, 4, 2, 4, 6, 4, 8]).astype("i4")),
+ "i": [3, 1, 1, 5, 7, 3, 5, 7],
+ "j": [1, 3, 5, 1, 3, 7, 7, 5],
+ "k": [4, 0, 4, 2, 4, 6, 4, 8],
"name": "",
"type": "mesh3d",
- "x": b64(
- np.array(
- [-1.0, 0.0, 1.0, -1.0, 0.0, 1.0, -1.0, 0.0, 1.0]
- ).astype("i4")
- ),
- "y": b64(
- np.array(
- [-1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0]
- ).astype("i4")
- ),
- "z": b64(
- np.array(
- [1.0, -0.0, -1.0, -0.0, 0.0, 0.0, -1.0, 0.0, 1.0]
- ).astype("f8")
- ),
+ "x": [-1.0, 0.0, 1.0, -1.0, 0.0, 1.0, -1.0, 0.0, 1.0],
+ "y": [-1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0],
+ "z": [1.0, -0.0, -1.0, -0.0, 0.0, 0.0, -1.0, 0.0, 1.0],
},
{
"line": {"color": "rgb(50, 50, 50)", "width": 1.5},
@@ -1536,9 +1541,9 @@ def test_trisurf_all_args(self):
"mode": "markers",
"showlegend": False,
"type": "scatter3d",
- "x": _b64(np.array([-1.0]).astype("i4")),
- "y": _b64(np.array([-1.0]).astype("i4")),
- "z": _b64(np.array([1.0]).astype("f8")),
+ "x": [-1.0],
+ "y": [-1.0],
+ "z": [1.0],
},
],
"layout": {
@@ -2351,7 +2356,6 @@ def test_group_stats(self):
group_stats={"apple": 1},
)
- @pytest.mark.skip(reason="On CI the floating values are slightly different")
def test_violin_fig(self):
# check: test violin fig matches expected fig
@@ -2471,212 +2475,212 @@ def test_violin_fig(self):
"(pdf(y), y)=(-0.41, 2.00)",
],
"type": "scatter",
- "x": _b64(
+ "x": np.array(
[
- -0.4106474407782997,
- -0.41293151166306874,
- -0.4151663470142996,
- -0.4173517718996741,
- -0.41948764339222333,
- -0.42157384967420297,
- -0.4236103090827412,
- -0.42559696909983546,
- -0.4275338052894279,
- -0.42942082018443417,
- -0.4312580421267441,
- -0.4330455240633402,
- -0.4347833423018088,
- -0.43647159522863094,
- -0.43811040199374884,
- -0.4396999011650012,
- -0.44124024935610784,
- -0.442731619831963,
- -0.44417420109506495,
- -0.44556819545696613,
- -0.4469138175986762,
- -0.4482112931239861,
- -0.44946085710970435,
- -0.45066275265681577,
- -0.45181722944656943,
- -0.45292454230549856,
- -0.45398494978335435,
- -0.4549987127479031,
- -0.45596609300049545,
- -0.4568873519162622,
- -0.4577627491127278,
- -0.45859254115055503,
- -0.45937698027005036,
- -0.4601163131669629,
- -0.46081077981100116,
- -0.4614606123103774,
- -0.46206603382556155,
- -0.46262725753529166,
- -0.46314448565774324,
- -0.46361790852960677,
- -0.46404770374566207,
- -0.4644340353612685,
- -0.4647770531600155,
- -0.4650768919885953,
- -0.46533367116076996,
- -0.46554749393211314,
- -0.4657184470470067,
- -0.4658466003591684,
- -0.46593200652678196,
- -0.46597470078308895,
- -0.4659747007830889,
- -0.46593200652678196,
- -0.46584660035916836,
- -0.4657184470470067,
- -0.46554749393211314,
- -0.46533367116076996,
- -0.46507689198859536,
- -0.4647770531600155,
- -0.4644340353612685,
- -0.46404770374566207,
- -0.46361790852960677,
- -0.46314448565774324,
- -0.46262725753529166,
- -0.46206603382556155,
- -0.4614606123103774,
- -0.46081077981100116,
- -0.4601163131669629,
- -0.4593769802700503,
- -0.45859254115055503,
- -0.4577627491127278,
- -0.4568873519162622,
- -0.4559660930004954,
- -0.45499871274790304,
- -0.45398494978335435,
- -0.45292454230549856,
- -0.4518172294465693,
- -0.4506627526568158,
- -0.44946085710970435,
- -0.448211293123986,
- -0.4469138175986762,
- -0.4455681954569661,
- -0.44417420109506495,
- -0.44273161983196296,
- -0.44124024935610784,
- -0.43969990116500113,
- -0.43811040199374884,
- -0.43647159522863094,
- -0.4347833423018088,
- -0.43304552406334024,
- -0.431258042126744,
- -0.4294208201844341,
- -0.4275338052894279,
- -0.42559696909983546,
- -0.4236103090827412,
- -0.42157384967420297,
- -0.4194876433922233,
- -0.41735177189967404,
- -0.4151663470142996,
- -0.4129315116630687,
- -0.4106474407782997,
+ -0.41064744,
+ -0.41293151,
+ -0.41516635,
+ -0.41735177,
+ -0.41948764,
+ -0.42157385,
+ -0.42361031,
+ -0.42559697,
+ -0.42753381,
+ -0.42942082,
+ -0.43125804,
+ -0.43304552,
+ -0.43478334,
+ -0.4364716,
+ -0.4381104,
+ -0.4396999,
+ -0.44124025,
+ -0.44273162,
+ -0.4441742,
+ -0.4455682,
+ -0.44691382,
+ -0.44821129,
+ -0.44946086,
+ -0.45066275,
+ -0.45181723,
+ -0.45292454,
+ -0.45398495,
+ -0.45499871,
+ -0.45596609,
+ -0.45688735,
+ -0.45776275,
+ -0.45859254,
+ -0.45937698,
+ -0.46011631,
+ -0.46081078,
+ -0.46146061,
+ -0.46206603,
+ -0.46262726,
+ -0.46314449,
+ -0.46361791,
+ -0.4640477,
+ -0.46443404,
+ -0.46477705,
+ -0.46507689,
+ -0.46533367,
+ -0.46554749,
+ -0.46571845,
+ -0.4658466,
+ -0.46593201,
+ -0.4659747,
+ -0.4659747,
+ -0.46593201,
+ -0.4658466,
+ -0.46571845,
+ -0.46554749,
+ -0.46533367,
+ -0.46507689,
+ -0.46477705,
+ -0.46443404,
+ -0.4640477,
+ -0.46361791,
+ -0.46314449,
+ -0.46262726,
+ -0.46206603,
+ -0.46146061,
+ -0.46081078,
+ -0.46011631,
+ -0.45937698,
+ -0.45859254,
+ -0.45776275,
+ -0.45688735,
+ -0.45596609,
+ -0.45499871,
+ -0.45398495,
+ -0.45292454,
+ -0.45181723,
+ -0.45066275,
+ -0.44946086,
+ -0.44821129,
+ -0.44691382,
+ -0.4455682,
+ -0.4441742,
+ -0.44273162,
+ -0.44124025,
+ -0.4396999,
+ -0.4381104,
+ -0.4364716,
+ -0.43478334,
+ -0.43304552,
+ -0.43125804,
+ -0.42942082,
+ -0.42753381,
+ -0.42559697,
+ -0.42361031,
+ -0.42157385,
+ -0.41948764,
+ -0.41735177,
+ -0.41516635,
+ -0.41293151,
+ -0.41064744,
]
),
- "y": _b64(
+ "y": np.array(
[
- 1,
- 1.0101010101010102,
- 1.02020202020202,
- 1.0303030303030303,
- 1.0404040404040404,
- 1.0505050505050506,
- 1.0606060606060606,
- 1.0707070707070707,
- 1.0808080808080809,
- 1.0909090909090908,
- 1.101010101010101,
- 1.1111111111111112,
- 1.121212121212121,
- 1.1313131313131313,
- 1.1414141414141414,
- 1.1515151515151516,
- 1.1616161616161615,
- 1.1717171717171717,
- 1.1818181818181819,
- 1.191919191919192,
- 1.202020202020202,
- 1.2121212121212122,
- 1.2222222222222223,
- 1.2323232323232323,
- 1.2424242424242424,
- 1.2525252525252526,
- 1.2626262626262625,
- 1.2727272727272727,
- 1.2828282828282829,
- 1.2929292929292928,
- 1.303030303030303,
- 1.3131313131313131,
- 1.3232323232323233,
- 1.3333333333333335,
- 1.3434343434343434,
- 1.3535353535353536,
- 1.3636363636363638,
- 1.3737373737373737,
- 1.3838383838383839,
- 1.393939393939394,
- 1.404040404040404,
- 1.4141414141414141,
- 1.4242424242424243,
- 1.4343434343434343,
- 1.4444444444444444,
- 1.4545454545454546,
- 1.4646464646464648,
- 1.474747474747475,
- 1.4848484848484849,
- 1.494949494949495,
- 1.5050505050505052,
- 1.5151515151515151,
- 1.5252525252525253,
- 1.5353535353535355,
- 1.5454545454545454,
- 1.5555555555555556,
- 1.5656565656565657,
- 1.5757575757575757,
- 1.5858585858585859,
- 1.595959595959596,
- 1.606060606060606,
- 1.6161616161616164,
- 1.6262626262626263,
- 1.6363636363636365,
- 1.6464646464646466,
- 1.6565656565656566,
- 1.6666666666666667,
- 1.676767676767677,
- 1.6868686868686869,
- 1.696969696969697,
- 1.7070707070707072,
- 1.7171717171717171,
- 1.7272727272727273,
- 1.7373737373737375,
- 1.7474747474747474,
- 1.7575757575757578,
- 1.7676767676767677,
- 1.7777777777777777,
- 1.787878787878788,
- 1.797979797979798,
- 1.8080808080808082,
- 1.8181818181818183,
- 1.8282828282828283,
- 1.8383838383838385,
- 1.8484848484848486,
- 1.8585858585858586,
- 1.8686868686868687,
- 1.878787878787879,
- 1.8888888888888888,
- 1.8989898989898992,
- 1.9090909090909092,
- 1.9191919191919191,
- 1.9292929292929295,
- 1.9393939393939394,
- 1.9494949494949496,
- 1.9595959595959598,
- 1.9696969696969697,
- 1.97979797979798,
- 1.98989898989899,
- 2,
+ 1.0,
+ 1.01010101,
+ 1.02020202,
+ 1.03030303,
+ 1.04040404,
+ 1.05050505,
+ 1.06060606,
+ 1.07070707,
+ 1.08080808,
+ 1.09090909,
+ 1.1010101,
+ 1.11111111,
+ 1.12121212,
+ 1.13131313,
+ 1.14141414,
+ 1.15151515,
+ 1.16161616,
+ 1.17171717,
+ 1.18181818,
+ 1.19191919,
+ 1.2020202,
+ 1.21212121,
+ 1.22222222,
+ 1.23232323,
+ 1.24242424,
+ 1.25252525,
+ 1.26262626,
+ 1.27272727,
+ 1.28282828,
+ 1.29292929,
+ 1.3030303,
+ 1.31313131,
+ 1.32323232,
+ 1.33333333,
+ 1.34343434,
+ 1.35353535,
+ 1.36363636,
+ 1.37373737,
+ 1.38383838,
+ 1.39393939,
+ 1.4040404,
+ 1.41414141,
+ 1.42424242,
+ 1.43434343,
+ 1.44444444,
+ 1.45454545,
+ 1.46464646,
+ 1.47474747,
+ 1.48484848,
+ 1.49494949,
+ 1.50505051,
+ 1.51515152,
+ 1.52525253,
+ 1.53535354,
+ 1.54545455,
+ 1.55555556,
+ 1.56565657,
+ 1.57575758,
+ 1.58585859,
+ 1.5959596,
+ 1.60606061,
+ 1.61616162,
+ 1.62626263,
+ 1.63636364,
+ 1.64646465,
+ 1.65656566,
+ 1.66666667,
+ 1.67676768,
+ 1.68686869,
+ 1.6969697,
+ 1.70707071,
+ 1.71717172,
+ 1.72727273,
+ 1.73737374,
+ 1.74747475,
+ 1.75757576,
+ 1.76767677,
+ 1.77777778,
+ 1.78787879,
+ 1.7979798,
+ 1.80808081,
+ 1.81818182,
+ 1.82828283,
+ 1.83838384,
+ 1.84848485,
+ 1.85858586,
+ 1.86868687,
+ 1.87878788,
+ 1.88888889,
+ 1.8989899,
+ 1.90909091,
+ 1.91919192,
+ 1.92929293,
+ 1.93939394,
+ 1.94949495,
+ 1.95959596,
+ 1.96969697,
+ 1.97979798,
+ 1.98989899,
+ 2.0,
]
),
},
@@ -2791,212 +2795,212 @@ def test_violin_fig(self):
"(pdf(y), y)=(0.41, 2.00)",
],
"type": "scatter",
- "x": _b64(
+ "x": np.array(
[
- 0.4106474407782997,
- 0.41293151166306874,
- 0.4151663470142996,
- 0.4173517718996741,
- 0.41948764339222333,
- 0.42157384967420297,
- 0.4236103090827412,
- 0.42559696909983546,
- 0.4275338052894279,
- 0.42942082018443417,
- 0.4312580421267441,
- 0.4330455240633402,
- 0.4347833423018088,
- 0.43647159522863094,
- 0.43811040199374884,
- 0.4396999011650012,
- 0.44124024935610784,
- 0.442731619831963,
- 0.44417420109506495,
- 0.44556819545696613,
- 0.4469138175986762,
- 0.4482112931239861,
- 0.44946085710970435,
- 0.45066275265681577,
- 0.45181722944656943,
- 0.45292454230549856,
- 0.45398494978335435,
- 0.4549987127479031,
- 0.45596609300049545,
- 0.4568873519162622,
- 0.4577627491127278,
- 0.45859254115055503,
- 0.45937698027005036,
- 0.4601163131669629,
- 0.46081077981100116,
- 0.4614606123103774,
- 0.46206603382556155,
- 0.46262725753529166,
- 0.46314448565774324,
- 0.46361790852960677,
- 0.46404770374566207,
- 0.4644340353612685,
- 0.4647770531600155,
- 0.4650768919885953,
- 0.46533367116076996,
- 0.46554749393211314,
- 0.4657184470470067,
- 0.4658466003591684,
- 0.46593200652678196,
- 0.46597470078308895,
- 0.4659747007830889,
- 0.46593200652678196,
- 0.46584660035916836,
- 0.4657184470470067,
- 0.46554749393211314,
- 0.46533367116076996,
- 0.46507689198859536,
- 0.4647770531600155,
- 0.4644340353612685,
- 0.46404770374566207,
- 0.46361790852960677,
- 0.46314448565774324,
- 0.46262725753529166,
- 0.46206603382556155,
- 0.4614606123103774,
- 0.46081077981100116,
- 0.4601163131669629,
- 0.4593769802700503,
- 0.45859254115055503,
- 0.4577627491127278,
- 0.4568873519162622,
- 0.4559660930004954,
- 0.45499871274790304,
- 0.45398494978335435,
- 0.45292454230549856,
- 0.4518172294465693,
- 0.4506627526568158,
- 0.44946085710970435,
- 0.448211293123986,
- 0.4469138175986762,
- 0.4455681954569661,
- 0.44417420109506495,
- 0.44273161983196296,
- 0.44124024935610784,
- 0.43969990116500113,
- 0.43811040199374884,
- 0.43647159522863094,
- 0.4347833423018088,
- 0.43304552406334024,
- 0.431258042126744,
- 0.4294208201844341,
- 0.4275338052894279,
- 0.42559696909983546,
- 0.4236103090827412,
- 0.42157384967420297,
- 0.4194876433922233,
- 0.41735177189967404,
- 0.4151663470142996,
- 0.4129315116630687,
- 0.4106474407782997,
+ 0.41064744,
+ 0.41293151,
+ 0.41516635,
+ 0.41735177,
+ 0.41948764,
+ 0.42157385,
+ 0.42361031,
+ 0.42559697,
+ 0.42753381,
+ 0.42942082,
+ 0.43125804,
+ 0.43304552,
+ 0.43478334,
+ 0.4364716,
+ 0.4381104,
+ 0.4396999,
+ 0.44124025,
+ 0.44273162,
+ 0.4441742,
+ 0.4455682,
+ 0.44691382,
+ 0.44821129,
+ 0.44946086,
+ 0.45066275,
+ 0.45181723,
+ 0.45292454,
+ 0.45398495,
+ 0.45499871,
+ 0.45596609,
+ 0.45688735,
+ 0.45776275,
+ 0.45859254,
+ 0.45937698,
+ 0.46011631,
+ 0.46081078,
+ 0.46146061,
+ 0.46206603,
+ 0.46262726,
+ 0.46314449,
+ 0.46361791,
+ 0.4640477,
+ 0.46443404,
+ 0.46477705,
+ 0.46507689,
+ 0.46533367,
+ 0.46554749,
+ 0.46571845,
+ 0.4658466,
+ 0.46593201,
+ 0.4659747,
+ 0.4659747,
+ 0.46593201,
+ 0.4658466,
+ 0.46571845,
+ 0.46554749,
+ 0.46533367,
+ 0.46507689,
+ 0.46477705,
+ 0.46443404,
+ 0.4640477,
+ 0.46361791,
+ 0.46314449,
+ 0.46262726,
+ 0.46206603,
+ 0.46146061,
+ 0.46081078,
+ 0.46011631,
+ 0.45937698,
+ 0.45859254,
+ 0.45776275,
+ 0.45688735,
+ 0.45596609,
+ 0.45499871,
+ 0.45398495,
+ 0.45292454,
+ 0.45181723,
+ 0.45066275,
+ 0.44946086,
+ 0.44821129,
+ 0.44691382,
+ 0.4455682,
+ 0.4441742,
+ 0.44273162,
+ 0.44124025,
+ 0.4396999,
+ 0.4381104,
+ 0.4364716,
+ 0.43478334,
+ 0.43304552,
+ 0.43125804,
+ 0.42942082,
+ 0.42753381,
+ 0.42559697,
+ 0.42361031,
+ 0.42157385,
+ 0.41948764,
+ 0.41735177,
+ 0.41516635,
+ 0.41293151,
+ 0.41064744,
]
),
- "y": _b64(
+ "y": np.array(
[
- 1,
- 1.0101010101010102,
- 1.02020202020202,
- 1.0303030303030303,
- 1.0404040404040404,
- 1.0505050505050506,
- 1.0606060606060606,
- 1.0707070707070707,
- 1.0808080808080809,
- 1.0909090909090908,
- 1.101010101010101,
- 1.1111111111111112,
- 1.121212121212121,
- 1.1313131313131313,
- 1.1414141414141414,
- 1.1515151515151516,
- 1.1616161616161615,
- 1.1717171717171717,
- 1.1818181818181819,
- 1.191919191919192,
- 1.202020202020202,
- 1.2121212121212122,
- 1.2222222222222223,
- 1.2323232323232323,
- 1.2424242424242424,
- 1.2525252525252526,
- 1.2626262626262625,
- 1.2727272727272727,
- 1.2828282828282829,
- 1.2929292929292928,
- 1.303030303030303,
- 1.3131313131313131,
- 1.3232323232323233,
- 1.3333333333333335,
- 1.3434343434343434,
- 1.3535353535353536,
- 1.3636363636363638,
- 1.3737373737373737,
- 1.3838383838383839,
- 1.393939393939394,
- 1.404040404040404,
- 1.4141414141414141,
- 1.4242424242424243,
- 1.4343434343434343,
- 1.4444444444444444,
- 1.4545454545454546,
- 1.4646464646464648,
- 1.474747474747475,
- 1.4848484848484849,
- 1.494949494949495,
- 1.5050505050505052,
- 1.5151515151515151,
- 1.5252525252525253,
- 1.5353535353535355,
- 1.5454545454545454,
- 1.5555555555555556,
- 1.5656565656565657,
- 1.5757575757575757,
- 1.5858585858585859,
- 1.595959595959596,
- 1.606060606060606,
- 1.6161616161616164,
- 1.6262626262626263,
- 1.6363636363636365,
- 1.6464646464646466,
- 1.6565656565656566,
- 1.6666666666666667,
- 1.676767676767677,
- 1.6868686868686869,
- 1.696969696969697,
- 1.7070707070707072,
- 1.7171717171717171,
- 1.7272727272727273,
- 1.7373737373737375,
- 1.7474747474747474,
- 1.7575757575757578,
- 1.7676767676767677,
- 1.7777777777777777,
- 1.787878787878788,
- 1.797979797979798,
- 1.8080808080808082,
- 1.8181818181818183,
- 1.8282828282828283,
- 1.8383838383838385,
- 1.8484848484848486,
- 1.8585858585858586,
- 1.8686868686868687,
- 1.878787878787879,
- 1.8888888888888888,
- 1.8989898989898992,
- 1.9090909090909092,
- 1.9191919191919191,
- 1.9292929292929295,
- 1.9393939393939394,
- 1.9494949494949496,
- 1.9595959595959598,
- 1.9696969696969697,
- 1.97979797979798,
- 1.98989898989899,
- 2,
+ 1.0,
+ 1.01010101,
+ 1.02020202,
+ 1.03030303,
+ 1.04040404,
+ 1.05050505,
+ 1.06060606,
+ 1.07070707,
+ 1.08080808,
+ 1.09090909,
+ 1.1010101,
+ 1.11111111,
+ 1.12121212,
+ 1.13131313,
+ 1.14141414,
+ 1.15151515,
+ 1.16161616,
+ 1.17171717,
+ 1.18181818,
+ 1.19191919,
+ 1.2020202,
+ 1.21212121,
+ 1.22222222,
+ 1.23232323,
+ 1.24242424,
+ 1.25252525,
+ 1.26262626,
+ 1.27272727,
+ 1.28282828,
+ 1.29292929,
+ 1.3030303,
+ 1.31313131,
+ 1.32323232,
+ 1.33333333,
+ 1.34343434,
+ 1.35353535,
+ 1.36363636,
+ 1.37373737,
+ 1.38383838,
+ 1.39393939,
+ 1.4040404,
+ 1.41414141,
+ 1.42424242,
+ 1.43434343,
+ 1.44444444,
+ 1.45454545,
+ 1.46464646,
+ 1.47474747,
+ 1.48484848,
+ 1.49494949,
+ 1.50505051,
+ 1.51515152,
+ 1.52525253,
+ 1.53535354,
+ 1.54545455,
+ 1.55555556,
+ 1.56565657,
+ 1.57575758,
+ 1.58585859,
+ 1.5959596,
+ 1.60606061,
+ 1.61616162,
+ 1.62626263,
+ 1.63636364,
+ 1.64646465,
+ 1.65656566,
+ 1.66666667,
+ 1.67676768,
+ 1.68686869,
+ 1.6969697,
+ 1.70707071,
+ 1.71717172,
+ 1.72727273,
+ 1.73737374,
+ 1.74747475,
+ 1.75757576,
+ 1.76767677,
+ 1.77777778,
+ 1.78787879,
+ 1.7979798,
+ 1.80808081,
+ 1.81818182,
+ 1.82828283,
+ 1.83838384,
+ 1.84848485,
+ 1.85858586,
+ 1.86868687,
+ 1.87878788,
+ 1.88888889,
+ 1.8989899,
+ 1.90909091,
+ 1.91919192,
+ 1.92929293,
+ 1.93939394,
+ 1.94949495,
+ 1.95959596,
+ 1.96969697,
+ 1.97979798,
+ 1.98989899,
+ 2.0,
]
),
},
@@ -3282,9 +3286,9 @@ def test_valid_facet_grid_fig(self):
"mode": "markers",
"opacity": 0.6,
"type": "scatter",
- "x": _b64([1.8, 1.8, 2.0, 2.0, 1.8, 1.8, 2.0]),
+ "x": [1.8, 1.8, 2.0, 2.0, 1.8, 1.8, 2.0],
"xaxis": "x",
- "y": _b64([18, 18, 20, 21, 18, 16, 20]),
+ "y": [18, 18, 20, 21, 18, 16, 20],
"yaxis": "y",
},
{
@@ -3296,9 +3300,9 @@ def test_valid_facet_grid_fig(self):
"mode": "markers",
"opacity": 0.6,
"type": "scatter",
- "x": _b64([2.8, 2.8, 3.1]),
+ "x": [2.8, 2.8, 3.1],
"xaxis": "x2",
- "y": _b64([16, 18, 18]),
+ "y": [16, 18, 18],
"yaxis": "y2",
},
],
@@ -3368,14 +3372,16 @@ def test_valid_facet_grid_fig(self):
"xaxis": {
"anchor": "y",
"domain": [0.0, 0.4925],
- "dtick": 1,
+ "dtick": 0,
+ "range": [0.85, 4.1575],
"ticklen": 0,
"zeroline": False,
},
"xaxis2": {
"anchor": "y2",
"domain": [0.5075, 1.0],
- "dtick": 1,
+ "dtick": 0,
+ "range": [0.85, 4.1575],
"ticklen": 0,
"zeroline": False,
},
@@ -3383,6 +3389,7 @@ def test_valid_facet_grid_fig(self):
"anchor": "x",
"domain": [0.0, 1.0],
"dtick": 1,
+ "range": [15.75, 21.2625],
"ticklen": 0,
"zeroline": False,
},
@@ -3391,6 +3398,7 @@ def test_valid_facet_grid_fig(self):
"domain": [0.0, 1.0],
"dtick": 1,
"matches": "y",
+ "range": [15.75, 21.2625],
"showticklabels": False,
"ticklen": 0,
"zeroline": False,
@@ -4240,7 +4248,9 @@ def test_simple_ternary_contour(self):
z = a * b * c
fig = ff.create_ternary_contour(np.stack((a, b, c)), z)
fig2 = ff.create_ternary_contour(np.stack((a, b)), z)
- assert fig2["data"][0]["a"], fig["data"][0]["a"]
+ np.testing.assert_array_almost_equal(
+ fig2["data"][0]["a"], fig["data"][0]["a"], decimal=3
+ )
def test_colorscale(self):
a, b = np.mgrid[0:1:20j, 0:1:20j]
@@ -4434,7 +4444,7 @@ def test_aggregation(self):
actual_agg = [2.0, 2.0, 1.0, 3.0, 9.0]
self.compare_dict_values(fig1.data[0].geojson, actual_geojson)
- assert np.array_equal(fig1.data[0].z, _b64(actual_agg))
+ assert np.array_equal(fig1.data[0].z, actual_agg)
fig2 = ff.create_hexbin_mapbox(
lat=lat,
@@ -4444,19 +4454,15 @@ def test_aggregation(self):
agg_func=np.mean,
)
- assert np.array_equal(fig2.data[0].z, _b64(np.ones(5)))
+ assert np.array_equal(fig2.data[0].z, np.ones(5))
- np.random.seed(0)
fig3 = ff.create_hexbin_mapbox(
lat=np.random.randn(1000),
lon=np.random.randn(1000),
nx_hexagon=20,
)
- assert fig3.data[0].z == {
- "bdata": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8D8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8D8AAAAAAAAAAAAAAAAAAPA/AAAAAAAA8D8AAAAAAAAAAAAAAAAAAPA/AAAAAAAAAAAAAAAAAADwPwAAAAAAAPA/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAPA/AAAAAAAAAEAAAAAAAADwPwAAAAAAAABAAAAAAAAAAEAAAAAAAAAgQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAFEAAAAAAAAAAQAAAAAAAACBAAAAAAAAAFEAAAAAAAAAIQAAAAAAAAPA/AAAAAAAACEAAAAAAAADwPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcQAAAAAAAABRAAAAAAAAAGEAAAAAAAAAgQAAAAAAAAABAAAAAAAAA8D8AAAAAAADwPwAAAAAAAAAAAAAAAAAAA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_dataframe(self):
np.random.seed(0)
diff --git a/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py
index 840a0d557c..c2e863c846 100644
--- a/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py
+++ b/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py
@@ -7,7 +7,6 @@
import base64
import datetime
from plotly.express.imshow_utils import rescale_intensity
-from plotly.tests.b64 import _b64
img_rgb = np.array([[[255, 0, 0], [0, 255, 0], [0, 0, 255]]], dtype=np.uint8)
img_gray = np.arange(100, dtype=float).reshape((10, 10))
@@ -182,7 +181,7 @@ def test_imshow_xarray(binary_string):
assert fig.layout.xaxis.title.text == "dim_cols"
assert fig.layout.yaxis.title.text == "dim_rows"
if not binary_string:
- assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_cols"]))
+ assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_cols"]))
def test_imshow_xarray_slicethrough():
@@ -192,7 +191,7 @@ def test_imshow_xarray_slicethrough():
# Dimensions are used for axis labels and coordinates
assert fig.layout.xaxis.title.text == "dim_2"
assert fig.layout.yaxis.title.text == "dim_1"
- assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_2"]))
+ assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_2"]))
def test_imshow_xarray_facet_col_string():
@@ -204,7 +203,7 @@ def test_imshow_xarray_facet_col_string():
# Dimensions are used for axis labels and coordinates
assert fig.layout.xaxis.title.text == "dim_2"
assert fig.layout.yaxis.title.text == "dim_1"
- assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_2"]))
+ assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_2"]))
def test_imshow_xarray_animation_frame_string():
@@ -216,7 +215,7 @@ def test_imshow_xarray_animation_frame_string():
# Dimensions are used for axis labels and coordinates
assert fig.layout.xaxis.title.text == "dim_2"
assert fig.layout.yaxis.title.text == "dim_1"
- assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_2"]))
+ assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_2"]))
def test_imshow_xarray_animation_facet_slicethrough():
@@ -226,7 +225,7 @@ def test_imshow_xarray_animation_facet_slicethrough():
# Dimensions are used for axis labels and coordinates
assert fig.layout.xaxis.title.text == "dim_3"
assert fig.layout.yaxis.title.text == "dim_2"
- assert np.all(np.array(fig.data[0].x) == _b64(da.coords["dim_3"]))
+ assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_3"]))
def test_imshow_labels_and_ranges():
@@ -292,7 +291,8 @@ def test_imshow_dataframe():
assert fig.data[0].x[0] == df.columns[0]
assert fig.data[0].x[0] == "nation"
assert fig.layout.xaxis.title.text is None
- assert fig.data[0].y == _b64(df.index)
+ assert fig.data[0].y[0] == df.index[0]
+ assert fig.data[0].y[0] == 0
assert fig.layout.yaxis.title.text is None
df = px.data.medals_wide(indexed=True)
diff --git a/packages/python/plotly/plotly/tests/test_optional/test_px/test_px.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px.py
index 11609d8de2..8bcff763ab 100644
--- a/packages/python/plotly/plotly/tests/test_optional/test_px/test_px.py
+++ b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px.py
@@ -3,15 +3,14 @@
import numpy as np
import pytest
from itertools import permutations
-from plotly.tests.b64 import _b64
def test_scatter():
iris = px.data.iris()
fig = px.scatter(iris, x="sepal_width", y="sepal_length")
assert fig.data[0].type == "scatter"
- assert np.all(fig.data[0].x == _b64(iris.sepal_width))
- assert np.all(fig.data[0].y == _b64(iris.sepal_length))
+ assert np.all(fig.data[0].x == iris.sepal_width)
+ assert np.all(fig.data[0].y == iris.sepal_length)
# test defaults
assert fig.data[0].mode == "markers"
@@ -29,11 +28,8 @@ def test_custom_data_scatter():
color="species",
hover_data=["petal_length", "petal_width"],
)
- assert fig.data[0].customdata == {
- "dtype": "f8",
- "bdata": "ZmZmZmZm9j+amZmZmZnJP2ZmZmZmZvY/mp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": "50, 2",
- }
+ for data in fig.data:
+ assert np.all(np.in1d(data.customdata[:, 1], iris.petal_width))
# Hover and custom data, no repeated arguments
fig = px.scatter(
iris,
diff --git a/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_functions.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_functions.py
index 77e2b32325..ec27441d6c 100644
--- a/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_functions.py
+++ b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_functions.py
@@ -4,7 +4,6 @@
import numpy as np
import pandas as pd
import pytest
-from plotly.tests.b64 import _b64
def _compare_figures(go_trace, px_fig):
@@ -18,9 +17,9 @@ def _compare_figures(go_trace, px_fig):
del go_fig["layout"]["template"]
del px_fig["layout"]["template"]
for key in go_fig["data"][0]:
- assert_array_equal(_b64(go_fig["data"][0][key]), _b64(px_fig["data"][0][key]))
+ assert_array_equal(go_fig["data"][0][key], px_fig["data"][0][key])
for key in go_fig["layout"]:
- assert _b64(go_fig["layout"][key]) == _b64(px_fig["layout"][key])
+ assert go_fig["layout"][key] == px_fig["layout"][key]
def test_pie_like_px():
@@ -150,11 +149,11 @@ def test_sunburst_treemap_with_path():
# Values passed
fig = px.sunburst(df, path=path, values="values")
assert fig.data[0].branchvalues == "total"
- assert fig.data[0].values == {"bdata": "AQMCBAICAQQGBQQECgkT", "dtype": "i1"}
+ assert fig.data[0].values[-1] == np.sum(values)
# Values passed
fig = px.sunburst(df, path=path, values="values")
assert fig.data[0].branchvalues == "total"
- assert fig.data[0].values == {"bdata": "AQMCBAICAQQGBQQECgkT", "dtype": "i1"}
+ assert fig.data[0].values[-1] == np.sum(values)
# Error when values cannot be converted to numerical data type
df["values"] = ["1 000", "3 000", "2", "4", "2", "2", "1 000", "4 000"]
msg = "Column `values` of `df` could not be converted to a numerical data type."
@@ -167,11 +166,9 @@ def test_sunburst_treemap_with_path():
# Continuous colorscale
df["values"] = 1
fig = px.sunburst(df, path=path, values="values", color="values")
- # assert "coloraxis" in fig.data[0].marker
- assert fig.data[0].values == {"bdata": "AQEBAQEBAQECAgICBAQI", "dtype": "i1"}
- # depending on pandas version we get different dtype for marker.colors
- assert fig.data[0].marker.colors["bdata"] is not None
- assert fig.data[0].marker.colors["dtype"] is not None
+ assert "coloraxis" in fig.data[0].marker
+ assert np.all(np.array(fig.data[0].marker.colors) == 1)
+ assert fig.data[0].values[-1] == 8
def test_sunburst_treemap_with_path_and_hover():
@@ -228,16 +225,10 @@ def test_sunburst_treemap_with_path_color():
path = ["total", "regions", "sectors", "vendors"]
fig = px.sunburst(df, path=path, values="values", color="calls")
colors = fig.data[0].marker.colors
- assert colors == {
- "bdata": "AAAAAAAAIEAAAAAAAAAAQAAAAAAAAPA/AAAAAAAACEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAEEAAAAAAAADwP6uqqqqqqgJAmpmZmZmZ+T8AAAAAAAAMQAAAAAAAAABAZmZmZmZmBkAcx3Ecx3H8P2wor6G8hgJA",
- "dtype": "f8",
- }
+ assert np.all(np.array(colors[:8]) == np.array(calls))
fig = px.sunburst(df, path=path, color="calls")
colors = fig.data[0].marker.colors
- assert colors == {
- "bdata": "AAAAAAAAIEAAAAAAAAAAQAAAAAAAAPA/AAAAAAAACEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAEEAAAAAAAADwPwAAAAAAAABAAAAAAAAABEAAAAAAAAAUQAAAAAAAAABAAAAAAAAADEAAAAAAAAACQAAAAAAAAAdA",
- "dtype": "f8",
- }
+ assert np.all(np.array(colors[:8]) == np.array(calls))
# Hover info
df["hover"] = [el.lower() for el in vendors]
@@ -261,10 +252,7 @@ def test_sunburst_treemap_with_path_color():
path = ["total", "regions", "sectors", "vendors"]
fig = px.sunburst(df, path=path, values="values", color="calls")
colors = fig.data[0].marker.colors
- assert colors == {
- "bdata": "AAAAAAAAIEAAAAAAAAAAQAAAAAAAAPA/AAAAAAAACEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAEEAAAAAAAADwP6uqqqqqqgJAmpmZmZmZ+T8AAAAAAAAMQAAAAAAAAABAZmZmZmZmBkAcx3Ecx3H8P2wor6G8hgJA",
- "dtype": "f8",
- }
+ assert np.all(np.array(colors[:8]) == np.array(calls))
def test_sunburst_treemap_column_parent():
@@ -337,7 +325,7 @@ def test_sunburst_treemap_with_path_non_rectangular():
fig = px.sunburst(df, path=path, values="values")
df.loc[df["vendors"].isnull(), "sectors"] = "Other"
fig = px.sunburst(df, path=path, values="values")
- assert fig.data[0].values == {"bdata": "AQMCBAICAQQGBQEBBAQLChU=", "dtype": "i1"}
+ assert fig.data[0].values[-1] == np.sum(values)
def test_pie_funnelarea_colorscale():
diff --git a/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py
index f3cfe8f8fd..a6bbf9b4e4 100644
--- a/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py
+++ b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py
@@ -7,7 +7,6 @@
import unittest.mock as mock
from plotly.express._core import build_dataframe
from pandas.testing import assert_frame_equal
-from plotly.tests.b64 import b64, _b64
import sys
import warnings
@@ -29,9 +28,8 @@ def add_interchange_module_for_old_pandas():
def test_numpy():
fig = px.scatter(x=[1, 2, 3], y=[2, 3, 4], color=[1, 3, 9])
-
- assert np.all(fig.data[0].x == b64(np.array([1, 2, 3])))
- assert np.all(fig.data[0].y == b64(np.array([2, 3, 4])))
+ assert np.all(fig.data[0].x == np.array([1, 2, 3]))
+ assert np.all(fig.data[0].y == np.array([2, 3, 4]))
assert np.all(fig.data[0].marker.color == np.array([1, 3, 9]))
@@ -103,16 +101,16 @@ def test_several_dataframes():
df = pd.DataFrame(dict(x=[0, 1], y=[3, 4]))
df2 = pd.DataFrame(dict(x=[3, 5], y=[23, 24]))
fig = px.scatter(x=df.y, y=df2.y)
- assert np.all(fig.data[0].x == b64(np.array([3, 4])))
- assert np.all(fig.data[0].y == b64(np.array([23, 24])))
+ assert np.all(fig.data[0].x == np.array([3, 4]))
+ assert np.all(fig.data[0].y == np.array([23, 24]))
assert fig.data[0].hovertemplate == "x=%{x}
y=%{y}"
df = pd.DataFrame(dict(x=[0, 1], y=[3, 4]))
df2 = pd.DataFrame(dict(x=[3, 5], y=[23, 24]))
df3 = pd.DataFrame(dict(y=[0.1, 0.2]))
fig = px.scatter(x=df.y, y=df2.y, size=df3.y)
- assert np.all(fig.data[0].x == b64(np.array([3, 4])))
- assert np.all(fig.data[0].y == b64(np.array([23, 24])))
+ assert np.all(fig.data[0].x == np.array([3, 4]))
+ assert np.all(fig.data[0].y == np.array([23, 24]))
assert (
fig.data[0].hovertemplate
== "x=%{x}
y=%{y}
size=%{marker.size}"
@@ -122,8 +120,8 @@ def test_several_dataframes():
df2 = pd.DataFrame(dict(x=[3, 5], y=[23, 24]))
df3 = pd.DataFrame(dict(y=[0.1, 0.2]))
fig = px.scatter(x=df.y, y=df2.y, hover_data=[df3.y])
- assert np.all(fig.data[0].x == b64(np.array([3, 4])))
- assert np.all(fig.data[0].y == b64(np.array([23, 24])))
+ assert np.all(fig.data[0].x == np.array([3, 4]))
+ assert np.all(fig.data[0].y == np.array([23, 24]))
assert (
fig.data[0].hovertemplate
== "x=%{x}
y=%{y}
hover_data_0=%{customdata[0]}"
@@ -133,8 +131,8 @@ def test_several_dataframes():
def test_name_heuristics():
df = pd.DataFrame(dict(x=[0, 1], y=[3, 4], z=[0.1, 0.2]))
fig = px.scatter(df, x=df.y, y=df.x, size=df.y)
- assert np.all(fig.data[0].x == b64(np.array([3, 4])))
- assert np.all(fig.data[0].y == b64(np.array([0, 1])))
+ assert np.all(fig.data[0].x == np.array([3, 4]))
+ assert np.all(fig.data[0].y == np.array([0, 1]))
assert fig.data[0].hovertemplate == "y=%{marker.size}
x=%{y}"
@@ -407,27 +405,27 @@ def test_splom_case():
assert len(fig.data[0].dimensions) == len(iris.columns)
dic = {"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}
fig = px.scatter_matrix(dic)
- assert np.all(fig.data[0].dimensions[0].values == b64(np.array(dic["a"])))
+ assert np.all(fig.data[0].dimensions[0].values == np.array(dic["a"]))
ar = np.arange(9).reshape((3, 3))
fig = px.scatter_matrix(ar)
- assert np.all(fig.data[0].dimensions[0].values == b64(ar[:, 0]))
+ assert np.all(fig.data[0].dimensions[0].values == ar[:, 0])
def test_int_col_names():
# DataFrame with int column names
lengths = pd.DataFrame(np.random.random(100))
fig = px.histogram(lengths, x=0)
- assert np.all(b64(np.array(lengths).flatten()) == fig.data[0].x)
+ assert np.all(np.array(lengths).flatten() == fig.data[0].x)
# Numpy array
ar = np.arange(100).reshape((10, 10))
fig = px.scatter(ar, x=2, y=8)
- assert np.all(fig.data[0].x == b64(ar[:, 2]))
+ assert np.all(fig.data[0].x == ar[:, 2])
def test_data_frame_from_dict():
fig = px.scatter({"time": [0, 1], "money": [1, 2]}, x="time", y="money")
assert fig.data[0].hovertemplate == "time=%{x}
money=%{y}"
- assert np.all(fig.data[0].x == _b64([0, 1]))
+ assert np.all(fig.data[0].x == [0, 1])
def test_arguments_not_modified():
@@ -491,11 +489,13 @@ def test_identity_map():
def test_constants():
fig = px.scatter(x=px.Constant(1), y=[1, 2])
- assert fig.data[0].x == _b64([1, 1])
+ assert fig.data[0].x[0] == 1
+ assert fig.data[0].x[1] == 1
assert "x=" in fig.data[0].hovertemplate
fig = px.scatter(x=px.Constant(1, label="time"), y=[1, 2])
- assert fig.data[0].x == _b64([1, 1])
+ assert fig.data[0].x[0] == 1
+ assert fig.data[0].x[1] == 1
assert "x=" not in fig.data[0].hovertemplate
assert "time=" in fig.data[0].hovertemplate
@@ -519,12 +519,15 @@ def test_constants():
def test_ranges():
fig = px.scatter(x=px.Range(), y=[1, 2], hover_data=[px.Range()])
- assert fig.data[0].x == _b64([0, 1])
- assert fig.data[0].customdata == _b64([[0], [1]])
+ assert fig.data[0].x[0] == 0
+ assert fig.data[0].x[1] == 1
+ assert fig.data[0].customdata[0][0] == 0
+ assert fig.data[0].customdata[1][0] == 1
assert "x=" in fig.data[0].hovertemplate
fig = px.scatter(x=px.Range(label="time"), y=[1, 2])
- assert fig.data[0].x == _b64([0, 1])
+ assert fig.data[0].x[0] == 0
+ assert fig.data[0].x[1] == 1
assert "x=" not in fig.data[0].hovertemplate
assert "time=" in fig.data[0].hovertemplate
@@ -614,55 +617,55 @@ def test_x_or_y(fn):
categorical_df = pd.DataFrame(dict(col=categorical), index=index)
fig = fn(x=numerical)
- assert fig.data[0].x == _b64(numerical)
- assert fig.data[0].y == _b64(range_4)
+ assert list(fig.data[0].x) == numerical
+ assert list(fig.data[0].y) == range_4
assert fig.data[0].orientation == "h"
fig = fn(y=numerical)
- assert fig.data[0].x == _b64(range_4)
- assert fig.data[0].y == _b64(numerical)
+ assert list(fig.data[0].x) == range_4
+ assert list(fig.data[0].y) == numerical
assert fig.data[0].orientation == "v"
fig = fn(numerical_df, x="col")
- assert fig.data[0].x == _b64(numerical)
- assert fig.data[0].y == _b64(index)
+ assert list(fig.data[0].x) == numerical
+ assert list(fig.data[0].y) == index
assert fig.data[0].orientation == "h"
fig = fn(numerical_df, y="col")
- assert fig.data[0].x == _b64(index)
- assert fig.data[0].y == _b64(numerical)
+ assert list(fig.data[0].x) == index
+ assert list(fig.data[0].y) == numerical
assert fig.data[0].orientation == "v"
if fn != px.bar:
fig = fn(x=categorical)
assert list(fig.data[0].x) == categorical
- assert fig.data[0].y == _b64(range_4)
+ assert list(fig.data[0].y) == range_4
assert fig.data[0].orientation == "h"
fig = fn(y=categorical)
- assert fig.data[0].x == _b64(range_4)
+ assert list(fig.data[0].x) == range_4
assert list(fig.data[0].y) == categorical
assert fig.data[0].orientation == "v"
fig = fn(categorical_df, x="col")
assert list(fig.data[0].x) == categorical
- assert fig.data[0].y == _b64(index)
+ assert list(fig.data[0].y) == index
assert fig.data[0].orientation == "h"
fig = fn(categorical_df, y="col")
- assert fig.data[0].x == _b64(index)
+ assert list(fig.data[0].x) == index
assert list(fig.data[0].y) == categorical
assert fig.data[0].orientation == "v"
else:
fig = fn(x=categorical)
assert list(fig.data[0].x) == categorical
- assert fig.data[0].y == _b64(constant)
+ assert list(fig.data[0].y) == constant
assert fig.data[0].orientation == "v"
fig = fn(y=categorical)
- assert fig.data[0].x == _b64(constant)
+ assert list(fig.data[0].x) == constant
assert list(fig.data[0].y) == categorical
assert fig.data[0].orientation == "h"
fig = fn(categorical_df, x="col")
assert list(fig.data[0].x) == categorical
- assert fig.data[0].y == _b64(constant)
+ assert list(fig.data[0].y) == constant
assert fig.data[0].orientation == "v"
fig = fn(categorical_df, y="col")
- assert fig.data[0].x == _b64(constant)
+ assert list(fig.data[0].x) == constant
assert list(fig.data[0].y) == categorical
assert fig.data[0].orientation == "h"
diff --git a/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_wide.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_wide.py
index bb190540ef..1aac7b70ea 100644
--- a/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_wide.py
+++ b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_wide.py
@@ -6,7 +6,6 @@
from pandas.testing import assert_frame_equal
import pytest
import warnings
-from plotly.tests.b64 import _b64
def test_is_col_list():
@@ -74,10 +73,10 @@ def test_wide_mode_external(px_fn, orientation, style):
if style == "explicit":
fig = px_fn(**{"data_frame": df, y: list(df.columns), x: df.index})
assert len(fig.data) == 3
- assert fig.data[0][x] == _b64([11, 12, 13])
- assert fig.data[0][y] == _b64([1, 2, 3])
- assert fig.data[1][x] == _b64([11, 12, 13])
- assert fig.data[1][y] == _b64([4, 5, 6])
+ assert list(fig.data[0][x]) == [11, 12, 13]
+ assert list(fig.data[0][y]) == [1, 2, 3]
+ assert list(fig.data[1][x]) == [11, 12, 13]
+ assert list(fig.data[1][y]) == [4, 5, 6]
assert fig.layout[xaxis].title.text == "index"
assert fig.layout[yaxis].title.text == "value"
assert fig.layout.legend.title.text == "variable"
@@ -85,8 +84,8 @@ def test_wide_mode_external(px_fn, orientation, style):
if style == "explicit":
fig = px_fn(**{"data_frame": df, y: list(df.columns), x: df.index})
assert len(fig.data) == 1
- assert fig.data[0][x] == _b64([11, 12, 13, 11, 12, 13, 11, 12, 13])
- assert fig.data[0][y] == _b64([1, 2, 3, 4, 5, 6, 7, 8, 9])
+ assert list(fig.data[0][x]) == [11, 12, 13, 11, 12, 13, 11, 12, 13]
+ assert list(fig.data[0][y]) == [1, 2, 3, 4, 5, 6, 7, 8, 9]
assert fig.layout[xaxis].title.text == "index"
assert fig.layout[yaxis].title.text == "value"
if px_fn in [px.violin, px.box, px.strip]:
@@ -94,14 +93,14 @@ def test_wide_mode_external(px_fn, orientation, style):
fig = px_fn(**{"data_frame": df, y: list(df.columns)})
assert len(fig.data) == 1
assert list(fig.data[0][x]) == ["a"] * 3 + ["b"] * 3 + ["c"] * 3
- assert fig.data[0][y] == _b64(range(1, 10))
+ assert list(fig.data[0][y]) == list(range(1, 10))
assert fig.layout[yaxis].title.text == "value"
assert fig.layout[xaxis].title.text == "variable"
if px_fn in [px.histogram]:
if style == "explicit":
fig = px_fn(**{"data_frame": df, x: list(df.columns)})
assert len(fig.data) == 3
- assert fig.data[1][x] == _b64([4, 5, 6])
+ assert list(fig.data[1][x]) == [4, 5, 6]
assert fig.layout.legend.title.text == "variable"
assert fig.layout[xaxis].title.text == "value"
diff --git a/packages/python/plotly/plotly/tests/test_optional/test_px/test_trendline.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_trendline.py
index 7aa04d7648..66046981ef 100644
--- a/packages/python/plotly/plotly/tests/test_optional/test_px/test_trendline.py
+++ b/packages/python/plotly/plotly/tests/test_optional/test_px/test_trendline.py
@@ -122,7 +122,8 @@ def test_trendline_nan_values(mode, options):
trendline_options=options,
)
for trendline in fig["data"][1::2]:
- assert trendline.x == {"bdata": "tAe5B74HwwfIB80H0gfXBw==", "dtype": "i2"}
+ assert trendline.x[0] >= start_date
+ assert len(trendline.x) == len(trendline.y)
def test_ols_trendline_slopes():
diff --git a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py
index 8e663a4ae1..cf32e1bdff 100644
--- a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py
+++ b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py
@@ -188,7 +188,7 @@ def test_figure_json_encoding(self):
'"z": [1, "A", "2014-01-05T00:00:00", '
'"2014-01-05T01:01:01", "2014-01-05T01:01:01.000001"]}'
)
- assert js2 == '{"type": "scatter", "x": {"bdata": "AQID", "dtype": "i1"}}'
+ assert js2 == '{"type": "scatter", "x": [1, 2, 3]}'
# Test JSON encoding works
_json.dumps(data, cls=utils.PlotlyJSONEncoder, sort_keys=True)
@@ -372,7 +372,6 @@ def test_invalid_encode_exception(self):
with self.assertRaises(TypeError):
_json.dumps({"a": {1}}, cls=utils.PlotlyJSONEncoder)
- @pytest.mark.skip(reason="The encoding is faster now.")
def test_fast_track_finite_arrays(self):
# if NaN or Infinity is found in the json dump
# of a figure, it is decoded and re-encoded to replace these values