(dash_duo)
| 482 | |
| 483 | |
| 484 | def test_pch006_base_operators(dash_duo): |
| 485 | app = Dash() |
| 486 | |
| 487 | app.layout = [ |
| 488 | dcc.Store(data=2, id="store"), |
| 489 | html.Button("add-one", id="add-one"), |
| 490 | html.Button("remove-one", id="remove-one"), |
| 491 | html.Button("mul-two", id="mul-two"), |
| 492 | html.Button("div-two", id="div-two"), |
| 493 | html.Button("merge", id="merge"), |
| 494 | dcc.Store(data={"initial": "initial"}, id="dict-store"), |
| 495 | html.Div(id="store-output"), |
| 496 | html.Div(id="dict-store-output"), |
| 497 | ] |
| 498 | |
| 499 | @app.callback( |
| 500 | Output("store", "data"), Input("add-one", "n_clicks"), prevent_initial_call=True |
| 501 | ) |
| 502 | def on_add(_): |
| 503 | patched = Patch() |
| 504 | patched += 1 |
| 505 | return patched |
| 506 | |
| 507 | @app.callback( |
| 508 | Output("store", "data", allow_duplicate=True), |
| 509 | Input("remove-one", "n_clicks"), |
| 510 | prevent_initial_call=True, |
| 511 | ) |
| 512 | def on_remove(_): |
| 513 | patched = Patch() |
| 514 | patched -= 1 |
| 515 | return patched |
| 516 | |
| 517 | @app.callback( |
| 518 | Output("store", "data", allow_duplicate=True), |
| 519 | Input("mul-two", "n_clicks"), |
| 520 | prevent_initial_call=True, |
| 521 | ) |
| 522 | def on_mul(_): |
| 523 | patched = Patch() |
| 524 | patched *= 2 |
| 525 | return patched |
| 526 | |
| 527 | @app.callback( |
| 528 | Output("store", "data", allow_duplicate=True), |
| 529 | Input("div-two", "n_clicks"), |
| 530 | prevent_initial_call=True, |
| 531 | ) |
| 532 | def on_div(_): |
| 533 | patched = Patch() |
| 534 | patched /= 2 |
| 535 | return patched |
| 536 | |
| 537 | @app.callback( |
| 538 | Output("dict-store", "data", allow_duplicate=True), |
| 539 | Input("merge", "n_clicks"), |
| 540 | prevent_initial_call=True, |
| 541 | ) |
nothing calls this directly
no test coverage detected
searching dependent graphs…