Skip to content

Commit 3702686

Browse files
committed
Code format
1 parent 98f2541 commit 3702686

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

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

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,49 @@ def test_performance_b64_scatter3d():
2020
z_list = z.tolist()
2121
c_list = c.tolist()
2222
list_start = time.time()
23-
fig = go.Figure(data=[go.Scatter3d(
24-
x=x_list,
25-
y=y_list,
26-
z=z_list,
27-
marker=dict(color=c_list),
28-
mode="markers",
29-
opacity=0.2,
30-
)])
23+
fig = go.Figure(
24+
data=[
25+
go.Scatter3d(
26+
x=x_list,
27+
y=y_list,
28+
z=z_list,
29+
marker=dict(color=c_list),
30+
mode="markers",
31+
opacity=0.2,
32+
)
33+
]
34+
)
3135
fig.show()
3236
list_time_elapsed = time.time() - list_start
3337

3438
# Test the performance with base64 arrays
3539
np_start = time.time()
36-
fig = go.Figure(data=[go.Scatter3d(
37-
x=x,
38-
y=y,
39-
z=z,
40-
marker=dict(color=c),
41-
mode="markers",
42-
opacity=0.2,
43-
)])
40+
fig = go.Figure(
41+
data=[
42+
go.Scatter3d(
43+
x=x,
44+
y=y,
45+
z=z,
46+
marker=dict(color=c),
47+
mode="markers",
48+
opacity=0.2,
49+
)
50+
]
51+
)
4452
fig.show()
4553
np_time_elapsed = time.time() - np_start
4654

4755
# np should be faster than lists
4856
assert (np_time_elapsed / list_time_elapsed) < 0.5
4957

58+
5059
FLOAT_TEST_CASES = [
51-
(
52-
"float32", # dtype
53-
0.45 # difference threshold
54-
),
55-
(
56-
'float64',
57-
0.55
58-
)
60+
("float32", 0.45), # dtype # difference threshold
61+
("float64", 0.55),
5962
]
60-
@pytest.mark.parametrize('dtype, expected_size_difference', FLOAT_TEST_CASES)
63+
64+
65+
@pytest.mark.parametrize("dtype, expected_size_difference", FLOAT_TEST_CASES)
6166
def test_performance_b64_float(dtype, expected_size_difference):
6267
np_arr_1 = np.random.random(10000).astype(dtype)
6368
np_arr_2 = np.random.random(10000).astype(dtype)
@@ -81,18 +86,14 @@ def test_performance_b64_float(dtype, expected_size_difference):
8186

8287

8388
INT_SIZE_PERFORMANCE_TEST_CASES = [
84-
(
85-
"uint8", # dtype
86-
256, # max_val
87-
400000 # difference threshold
88-
),
89-
(
90-
'uint32',
91-
2**32,
92-
900000
93-
)
89+
("uint8", 256, 400000), # dtype # max_val # difference threshold
90+
("uint32", 2**32, 900000),
9491
]
95-
@pytest.mark.parametrize('dtype, max_val, expected_size_difference', INT_SIZE_PERFORMANCE_TEST_CASES)
92+
93+
94+
@pytest.mark.parametrize(
95+
"dtype, max_val, expected_size_difference", INT_SIZE_PERFORMANCE_TEST_CASES
96+
)
9697
def test_size_performance_b64_int(dtype, max_val, expected_size_difference):
9798
np_arr_1 = (np.random.random(100000) * max_val).astype(dtype)
9899
np_arr_2 = (np.random.random(100000) * max_val).astype(dtype)

0 commit comments

Comments
 (0)