Skip to content

Commit 3d7bc0c

Browse files
committed
convert a few wildcard tests - including clientside callbacks - to unwrapped args
1 parent 302f44c commit 3d7bc0c

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

tests/integration/callbacks/test_wildcards.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,14 @@ def display_content(_):
5151
app.total_calls = Value("i", 0)
5252

5353
@app.callback(
54-
[Output("list-container", "children"), Output("new-item", "value")],
55-
[
56-
Input("add", "n_clicks"),
57-
Input("new-item", "n_submit"),
58-
Input("clear-done", "n_clicks"),
59-
],
60-
[
61-
State("new-item", "value"),
62-
State({"item": ALL}, "children"),
63-
State({"item": ALL, "action": "done"}, "value"),
64-
],
54+
Output("list-container", "children"),
55+
Output("new-item", "value"),
56+
Input("add", "n_clicks"),
57+
Input("new-item", "n_submit"),
58+
Input("clear-done", "n_clicks"),
59+
State("new-item", "value"),
60+
State({"item": ALL}, "children"),
61+
State({"item": ALL, "action": "done"}, "value"),
6562
)
6663
def edit_list(add, add2, clear, new_item, items, items_done):
6764
app.list_calls.value += 1
@@ -99,18 +96,16 @@ def edit_list(add, add2, clear, new_item, items, items_done):
9996

10097
@app.callback(
10198
Output({"item": MATCH}, "style"),
102-
[Input({"item": MATCH, "action": "done"}, "value")],
99+
Input({"item": MATCH, "action": "done"}, "value"),
103100
)
104101
def mark_done(done):
105102
app.style_calls.value += 1
106103
return style_done if done else style_todo
107104

108105
@app.callback(
109106
Output({"item": MATCH, "preceding": True}, "children"),
110-
[
111-
Input({"item": ALLSMALLER, "action": "done"}, "value"),
112-
Input({"item": MATCH, "action": "done"}, "value"),
113-
],
107+
Input({"item": ALLSMALLER, "action": "done"}, "value"),
108+
Input({"item": MATCH, "action": "done"}, "value"),
114109
)
115110
def show_preceding(done_before, this_done):
116111
app.preceding_calls.value += 1
@@ -124,7 +119,7 @@ def show_preceding(done_before, this_done):
124119
return out
125120

126121
@app.callback(
127-
Output("totals", "children"), [Input({"item": ALL, "action": "done"}, "value")]
122+
Output("totals", "children"), Input({"item": ALL, "action": "done"}, "value")
128123
)
129124
def show_totals(done):
130125
app.total_calls.value += 1
@@ -253,7 +248,7 @@ def fibonacci_app(clientside):
253248
]
254249
)
255250

256-
@app.callback(Output("series", "children"), [Input("n", "value")])
251+
@app.callback(Output("series", "children"), Input("n", "value"))
257252
def items(n):
258253
return [html.Div(id={"i": i}) for i in range(n)]
259254

@@ -266,7 +261,7 @@ def items(n):
266261
}
267262
""",
268263
Output({"i": MATCH}, "children"),
269-
[Input({"i": ALLSMALLER}, "children")],
264+
Input({"i": ALLSMALLER}, "children"),
270265
)
271266

272267
app.clientside_callback(
@@ -277,13 +272,13 @@ def items(n):
277272
}
278273
""",
279274
Output("sum", "children"),
280-
[Input({"i": ALL}, "children")],
275+
Input({"i": ALL}, "children"),
281276
)
282277

283278
else:
284279

285280
@app.callback(
286-
Output({"i": MATCH}, "children"), [Input({"i": ALLSMALLER}, "children")]
281+
Output({"i": MATCH}, "children"), Input({"i": ALLSMALLER}, "children")
287282
)
288283
def sequence(prev):
289284
global fibonacci_count
@@ -294,7 +289,7 @@ def sequence(prev):
294289
return len(prev)
295290
return int(prev[-1] or 0) + int(prev[-2] or 0)
296291

297-
@app.callback(Output("sum", "children"), [Input({"i": ALL}, "children")])
292+
@app.callback(Output("sum", "children"), Input({"i": ALL}, "children"))
298293
def show_sum(seq):
299294
global fibonacci_sum_count
300295
fibonacci_sum_count = fibonacci_sum_count + 1

0 commit comments

Comments
 (0)