Skip to content

Commit 024f3c1

Browse files
committed
Black
1 parent 554f5cb commit 024f3c1

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_performance.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@
55

66
np.random.seed(1)
77

8+
89
def test_performance_scatter3d():
910
N = 10000
1011

1112
x = np.random.randn(N)
12-
y = np.random.randn(N).astype('float32')
13-
z = np.random.randint(size=N, low=0, high=256, dtype='uint8')
14-
c = np.random.randint(size=N, low=-10, high=10, dtype='int8')
13+
y = np.random.randn(N).astype("float32")
14+
z = np.random.randint(size=N, low=0, high=256, dtype="uint8")
15+
c = np.random.randint(size=N, low=-10, high=10, dtype="int8")
1516

1617
# Test the performance with lists
1718
list_start = time.time()
18-
fig = go.Figure(data=[go.Scatter3d(
19-
x=x.tolist(),
20-
y=y.tolist(),
21-
z=z.tolist(),
22-
marker=dict(color=c.tolist()),
23-
mode='markers',
24-
opacity=0.2
25-
)])
19+
fig = go.Figure(
20+
data=[
21+
go.Scatter3d(
22+
x=x.tolist(),
23+
y=y.tolist(),
24+
z=z.tolist(),
25+
marker=dict(color=c.tolist()),
26+
mode="markers",
27+
opacity=0.2,
28+
)
29+
]
30+
)
2631
list_time_elapsed = time.time() - list_start
2732

2833
# Test the performance with base64 arrays
@@ -32,14 +37,15 @@ def test_performance_scatter3d():
3237
y=b64(y),
3338
z=b64(z),
3439
marker=dict(color=b64(c)),
35-
mode='markers',
36-
opacity=0.2
40+
mode="markers",
41+
opacity=0.2,
3742
)
3843
b64_time_elapsed = time.time() - b64_start
3944

4045
# b64 should be faster than raw
4146
assert (b64_time_elapsed / list_time_elapsed) < 0.75
4247

48+
4349
def test_performance_b64_float64():
4450
np_arr_1 = np.random.random(10000)
4551
np_arr_2 = np.random.random(10000)

packages/python/plotly/test_requirements/requirements_312_core.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ requests==2.25.1
22
tenacity==6.2.0
33
pytest==7.4.4
44
numpy==1.23.2
5-
setuptools==69.5.1
5+
setuptools

0 commit comments

Comments
 (0)