Skip to content

Commit d201b58

Browse files
committed
Code format
1 parent 259d509 commit d201b58

File tree

1 file changed

+45
-53
lines changed

1 file changed

+45
-53
lines changed

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

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,40 @@
22
import numpy as np
33
from plotly.tests.test_optional.optional_utils import NumpyTestUtilsMixin
44
import plotly.graph_objs as go
5-
import plotly.io as pio
65

7-
pio.renderers.default = 'iframe'
86

97
class TestSkippedBase64Keys(NumpyTestUtilsMixin, TestCase):
108
def test_np_geojson(self):
11-
normal_coordinates = [[
12-
[-87, 35],
13-
[-87, 30],
14-
[-85, 30],
15-
[-85, 35],
16-
]]
9+
normal_coordinates = [
10+
[
11+
[-87, 35],
12+
[-87, 30],
13+
[-85, 30],
14+
[-85, 35],
15+
]
16+
]
1717

18-
numpy_coordinates = np.array(normal_coordinates)
18+
numpy_coordinates = np.array(normal_coordinates)
1919

20-
data = [{
21-
"type": "choropleth",
22-
"locations": ["AL"],
23-
"featureidkey": "properties.id",
24-
"z": np.array([10]),
25-
"geojson": {
26-
"type": "Feature",
27-
"properties": {
28-
"id": "AL"
29-
},
30-
"geometry": {
31-
"type": "Polygon",
32-
"coordinates": numpy_coordinates
33-
}
34-
}
35-
}]
20+
data = [
21+
{
22+
"type": "choropleth",
23+
"locations": ["AL"],
24+
"featureidkey": "properties.id",
25+
"z": np.array([10]),
26+
"geojson": {
27+
"type": "Feature",
28+
"properties": {"id": "AL"},
29+
"geometry": {"type": "Polygon", "coordinates": numpy_coordinates},
30+
},
31+
}
32+
]
3633

37-
fig = go.Figure(data=data)
38-
fig.show()
34+
fig = go.Figure(data=data)
3935

40-
assert (fig["data"][0]["geojson"]["geometry"]["coordinates"] == normal_coordinates).all()
36+
assert (
37+
fig["data"][0]["geojson"]["geometry"]["coordinates"] == normal_coordinates
38+
).all()
4139

4240
def test_np_layers(self):
4341
layout = {
@@ -46,50 +44,44 @@ def test_np_layers(self):
4644
{
4745
"sourcetype": "geojson",
4846
"type": "line",
49-
"line": {
50-
"dash": np.array([2.5, 1])
51-
},
47+
"line": {"dash": np.array([2.5, 1])},
5248
"source": {
5349
"type": "FeatureCollection",
5450
"features": [
5551
{
5652
"type": "Feature",
5753
"geometry": {
5854
"type": "LineString",
59-
"coordinates": np.array([[0.25, 52], [0.75, 50]])
55+
"coordinates": np.array(
56+
[[0.25, 52], [0.75, 50]]
57+
),
6058
},
6159
}
62-
]
63-
}
60+
],
61+
},
6462
},
6563
],
66-
"center": {
67-
"lon": 0.5,
68-
"lat": 51
69-
}
64+
"center": {"lon": 0.5, "lat": 51},
7065
},
7166
}
72-
data = [
73-
{
74-
"type": "scattermapbox"
75-
}
76-
]
67+
data = [{"type": "scattermapbox"}]
7768

7869
fig = go.Figure(data=data, layout=layout)
7970

8071
# TODO: This is failing because the actual value of the "dash" field
81-
# is converted to the { b64, dtype } object.
72+
# is converted to the { b64, dtype } object.
8273
# assert fig.layout['mapbox']['layers'][0]['line']['dash'] == (2.5, 1)
83-
84-
assert (fig.layout['mapbox']['layers'][0]['source']['features'][0]['geometry']['coordinates'] == [[0.25, 52], [0.75, 50]]).all()
74+
75+
assert (
76+
fig.layout["mapbox"]["layers"][0]["source"]["features"][0]["geometry"][
77+
"coordinates"
78+
]
79+
== [[0.25, 52], [0.75, 50]]
80+
).all()
8581

8682
def test_np_range(self):
87-
layout = {
88-
"xaxis": {
89-
"range": np.array([0, 1])
90-
}
91-
}
83+
layout = {"xaxis": {"range": np.array([0, 1])}}
9284

93-
fig = go.Figure(data=[{ "type": "scatter" }], layout=layout)
85+
fig = go.Figure(data=[{"type": "scatter"}], layout=layout)
9486

95-
assert fig.layout["xaxis"]["range"] == (0, 1)
87+
assert fig.layout["xaxis"]["range"] == (0, 1)

0 commit comments

Comments
 (0)