Skip to content

Commit ca5eaf8

Browse files
committed
fixing for lint
1 parent 1faf5e6 commit ca5eaf8

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

tests/integration/clientside/test_clientside_functions.py

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,62 @@
33
from multiprocessing import Value
44
import time
55

6+
67
def test_sp001_clientside_setprops(dash_duo):
78

89
call_count = Value("i", 0)
910

1011
app = Dash(__name__)
1112

12-
ids = [{'id': {'index': '1', 'type': 'test'}, 'children': ['rawr']}, {'id': 'two', 'children': 'this is a test'}, {'id': 'three', 'children': 'i see trees of green'}]
13+
ids = [
14+
{"id": {"index": "1", "type": "test"}, "children": ["rawr"]},
15+
{"id": "two", "children": "this is a test"},
16+
{"id": "three", "children": "i see trees of green"},
17+
]
1318

14-
app.layout = html.Div([*[html.Div(id=x['id']) for x in ids], html.Div(id='four'), html.Button(id='setup', children='test setprops')])
19+
app.layout = html.Div(
20+
[
21+
*[html.Div(id=x["id"]) for x in ids],
22+
html.Div(id="four"),
23+
html.Button(id="setup", children="test setprops"),
24+
]
25+
)
1526

1627
app.clientside_callback(
1728
"""
1829
() => {
19-
window.dash_clientside.setProps(""" + json.dumps(ids) + """)
30+
window.dash_clientside.setProps("""
31+
+ json.dumps(ids)
32+
+ """)
2033
return window.dash_clientside.no_update
2134
}
2235
""",
23-
Output('setup', 'id'),
24-
Input('setup', 'n_clicks'),
25-
prevent_initial_call=True
36+
Output("setup", "id"),
37+
Input("setup", "n_clicks"),
38+
prevent_initial_call=True,
2639
)
2740

2841
for x in ids:
29-
@app.callback(Output(x['id'],'id', allow_duplicate=True), Output('four','children', allow_duplicate=True), Input(x['id'], 'children'),
30-
State(x['id'], 'id'), prevent_initial_call=True)
42+
43+
@app.callback(
44+
Output(x["id"], "id", allow_duplicate=True),
45+
Output("four", "children", allow_duplicate=True),
46+
Input(x["id"], "children"),
47+
State(x["id"], "id"),
48+
prevent_initial_call=True,
49+
)
3150
def prinout(c, id):
3251
call_count.value += 1
3352
for y in ids:
34-
if y['id'] == id:
35-
assert y['children'] == c
53+
if y["id"] == id:
54+
assert y["children"] == c
3655
return no_update, call_count.value
3756

3857
dash_duo.start_server(app)
3958

40-
dash_duo.wait_for_text_to_equal("#setup", 'test setprops')
59+
dash_duo.wait_for_text_to_equal("#setup", "test setprops")
4160
dash_duo.find_element("#setup").click()
4261
time.sleep(1)
43-
dash_duo.wait_for_text_to_equal("#two", 'this is a test')
44-
dash_duo.wait_for_text_to_equal("#three", 'i see trees of green')
45-
dash_duo.wait_for_text_to_equal("#four", '3')
62+
dash_duo.wait_for_text_to_equal("#two", "this is a test")
63+
dash_duo.wait_for_text_to_equal("#three", "i see trees of green")
64+
dash_duo.wait_for_text_to_equal("#four", "3")

0 commit comments

Comments
 (0)