Skip to content

Commit 3b8512c

Browse files
committed
fixing for lint
1 parent 9bb570b commit 3b8512c

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
from dash import (
32
Dash,
43
Input,
@@ -10,16 +9,21 @@
109
import json
1110
from flask import jsonify
1211

13-
test_string = ('{"step_0": "Data fetched - 1", "step_1": "Data fetched - 1", "step_2": "Data fetched - 1", '
14-
'"step_3": "Data fetched - 1", "step_4": "Data fetched - 1"}')
12+
test_string = (
13+
'{"step_0": "Data fetched - 1", "step_1": "Data fetched - 1", "step_2": "Data fetched - 1", '
14+
'"step_3": "Data fetched - 1", "step_4": "Data fetched - 1"}'
15+
)
16+
1517

1618
def test_apib001_api_callback(dash_duo):
1719

1820
app = Dash(__name__)
19-
app.layout = html.Div([
20-
html.Button("Slow Callback", id="slow-btn"),
21-
html.Div(id="slow-output"),
22-
])
21+
app.layout = html.Div(
22+
[
23+
html.Button("Slow Callback", id="slow-btn"),
24+
html.Div(id="slow-output"),
25+
]
26+
)
2327

2428
def get_data(n_clicks):
2529
# Simulate an async data fetch
@@ -29,12 +33,12 @@ def get_data(n_clicks):
2933
Output("slow-output", "children"),
3034
Input("slow-btn", "n_clicks"),
3135
prevent_initial_call=True,
32-
api_endpoint='/api/slow_callback', # Example API path for the slow callback
36+
api_endpoint="/api/slow_callback", # Example API path for the slow callback
3337
)
3438
def slow_callback(n_clicks):
3539
data = {}
3640
for i in range(5):
37-
data[f'step_{i}'] = get_data(n_clicks)
41+
data[f"step_{i}"] = get_data(n_clicks)
3842
ret = f"{json.dumps(data)}"
3943
if ctx:
4044
return ret
@@ -46,8 +50,10 @@ def slow_callback(n_clicks):
4650

4751
dash_duo.wait_for_element("#slow-btn").click()
4852
dash_duo.wait_for_text_to_equal("#slow-output", test_string)
49-
r = requests.post(dash_duo.server_url +'/api/slow_callback',
50-
json={'n_clicks': 1},
51-
headers={'Content-Type': 'application/json'})
53+
r = requests.post(
54+
dash_duo.server_url + "/api/slow_callback",
55+
json={"n_clicks": 1},
56+
headers={"Content-Type": "application/json"},
57+
)
5258
assert r.status_code == 200
5359
assert r.json() == test_string

0 commit comments

Comments
 (0)