Skip to content

Commit bd0a2d3

Browse files
committed
Update base64 tests to reflect new approach
1 parent 8fff9c5 commit bd0a2d3

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

packages/python/plotly/plotly/tests/test_optional/test_graph_objs/test_skipped_b64_keys.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
from unittest import TestCase
23
import numpy as np
34
from plotly.tests.test_optional.optional_utils import NumpyTestUtilsMixin
@@ -34,8 +35,9 @@ def test_np_geojson(self):
3435
fig = go.Figure(data=data)
3536

3637
assert (
37-
fig["data"][0]["geojson"]["geometry"]["coordinates"] == normal_coordinates
38-
).all()
38+
json.loads(fig.to_json())["data"][0]["geojson"]["geometry"]["coordinates"]
39+
== normal_coordinates
40+
)
3941

4042
def test_np_layers(self):
4143
layout = {
@@ -68,18 +70,15 @@ def test_np_layers(self):
6870

6971
fig = go.Figure(data=data, layout=layout)
7072

71-
assert fig.layout["mapbox"]["layers"][0]["line"]["dash"] == (2.5, 1)
73+
assert (fig.layout["mapbox"]["layers"][0]["line"]["dash"] == (2.5, 1)).all()
7274

73-
assert (
74-
fig.layout["mapbox"]["layers"][0]["source"]["features"][0]["geometry"][
75-
"coordinates"
76-
]
77-
== [[0.25, 52], [0.75, 50]]
78-
).all()
75+
assert json.loads(fig.to_json())["layout"]["mapbox"]["layers"][0]["source"][
76+
"features"
77+
][0]["geometry"]["coordinates"] == [[0.25, 52], [0.75, 50]]
7978

8079
def test_np_range(self):
8180
layout = {"xaxis": {"range": np.array([0, 1])}}
8281

8382
fig = go.Figure(data=[{"type": "scatter"}], layout=layout)
8483

85-
assert fig.layout["xaxis"]["range"] == (0, 1)
84+
assert json.loads(fig.to_json())["layout"]["xaxis"]["range"] == [0, 1]

0 commit comments

Comments
 (0)