@@ -502,14 +502,15 @@ def test_tabs_in_vertical_mode(self):
502
502
dcc .Tab (label = 'Tab three' , value = 'tab-3' , id = 'tab-3' , children = [
503
503
html .Div ('Tab Three Content' )
504
504
]),
505
- ], vertical = True ),
505
+ ], vertical = True ),
506
506
html .Div (id = 'tabs-content' )
507
507
])
508
508
509
509
self .startServer (app = app )
510
510
self .wait_for_text_to_equal ('#tab-3' , 'Tab three' )
511
511
512
512
self .snapshot ('Tabs - vertical mode' )
513
+
513
514
def test_tabs_without_children (self ):
514
515
app = dash .Dash (__name__ )
515
516
@@ -518,18 +519,18 @@ def test_tabs_without_children(self):
518
519
dcc .Tabs (id = "tabs" , value = 'tab-2' , children = [
519
520
dcc .Tab (label = 'Tab one' , value = 'tab-1' , id = 'tab-1' ),
520
521
dcc .Tab (label = 'Tab two' , value = 'tab-2' , id = 'tab-2' ),
521
- ]),
522
+ ]),
522
523
html .Div (id = 'tabs-content' )
523
524
])
524
525
525
526
@app .callback (dash .dependencies .Output ('tabs-content' , 'children' ),
526
- [dash .dependencies .Input ('tabs' , 'value' )])
527
+ [dash .dependencies .Input ('tabs' , 'value' )])
527
528
def render_content (tab ):
528
- if ( tab == 'tab-1' ) :
529
+ if tab == 'tab-1' :
529
530
return html .Div ([
530
531
html .H3 ('Test content 1' )
531
532
], id = 'test-tab-1' )
532
- elif ( tab == 'tab-2' ) :
533
+ elif tab == 'tab-2' :
533
534
return html .Div ([
534
535
html .H3 ('Test content 2' )
535
536
], id = 'test-tab-2' )
@@ -565,7 +566,6 @@ def test_tabs_render_without_selected(self):
565
566
{'id' : 'two' , 'value' : 2 },
566
567
]
567
568
568
-
569
569
menu = html .Div ([
570
570
html .Div ('one' , id = 'one' ),
571
571
html .Div ('two' , id = 'two' )
@@ -583,7 +583,6 @@ def test_tabs_render_without_selected(self):
583
583
])
584
584
], id = 'tabs-two' , style = {'display' : 'none' })
585
585
586
-
587
586
app .layout = html .Div ([
588
587
menu ,
589
588
tabs_one ,
@@ -593,7 +592,7 @@ def test_tabs_render_without_selected(self):
593
592
for i in ('one' , 'two' ):
594
593
595
594
@app .callback (Output ('tabs-{}' .format (i ), 'style' ),
596
- [Input (i , 'n_clicks' )])
595
+ [Input (i , 'n_clicks' )])
597
596
def on_click (n_clicks ):
598
597
if n_clicks is None :
599
598
raise PreventUpdate
@@ -602,18 +601,17 @@ def on_click(n_clicks):
602
601
return {'display' : 'block' }
603
602
return {'display' : 'none' }
604
603
605
-
606
604
@app .callback (Output ('graph-{}' .format (i ), 'figure' ),
607
- [Input (i , 'n_clicks' )])
605
+ [Input (i , 'n_clicks' )])
608
606
def on_click (n_clicks ):
609
607
if n_clicks is None :
610
608
raise PreventUpdate
611
609
612
610
return {
613
611
'data' : [
614
612
{
615
- 'x' : [1 ,2 , 3 , 4 ],
616
- 'y' : [4 ,3 , 2 , 1 ]
613
+ 'x' : [1 , 2 , 3 , 4 ],
614
+ 'y' : [4 , 3 , 2 , 1 ]
617
615
}
618
616
]
619
617
}
@@ -655,9 +653,8 @@ def test_tabs_without_value(self):
655
653
html .Div (id = 'tabs-content' )
656
654
])
657
655
658
-
659
656
@app .callback (Output ('tabs-content' , 'children' ),
660
- [Input ('tabs-without-value' , 'value' )])
657
+ [Input ('tabs-without-value' , 'value' )])
661
658
def render_content (tab ):
662
659
if tab == 'tab-1' :
663
660
return html .H3 ('Default selected Tab content 1' )
@@ -682,7 +679,7 @@ def test_graph_does_not_resize_in_tabs(self):
682
679
])
683
680
684
681
@app .callback (Output ('tabs-content-example' , 'children' ),
685
- [Input ('tabs-example' , 'value' )])
682
+ [Input ('tabs-example' , 'value' )])
686
683
def render_content (tab ):
687
684
if tab == 'tab-1-example' :
688
685
return html .Div ([
@@ -744,7 +741,6 @@ def render_content(tab):
744
741
745
742
self .snapshot ("Tabs with Graph - clicked tab 1 (graph should not resize)" )
746
743
747
-
748
744
def test_location_link (self ):
749
745
app = dash .Dash (__name__ )
750
746
@@ -889,7 +885,7 @@ def test_link_scroll(self):
889
885
call_count = Value ('i' , 0 )
890
886
891
887
@app .callback (Output ('page-content' , 'children' ),
892
- [Input ('test-url' , 'pathname' )])
888
+ [Input ('test-url' , 'pathname' )])
893
889
def display_page (pathname ):
894
890
call_count .value = call_count .value + 1
895
891
return 'You are on page {}' .format (pathname )
@@ -898,7 +894,7 @@ def display_page(pathname):
898
894
899
895
time .sleep (2 )
900
896
901
- #callback is called twice when defined
897
+ # callback is called twice when defined
902
898
self .assertEqual (
903
899
call_count .value ,
904
900
2
@@ -917,11 +913,11 @@ def display_page(pathname):
917
913
self .wait_for_text_to_equal (
918
914
'#page-content' , 'You are on page /test-link' )
919
915
920
- #test if rendered Link's <a> tag has a href attribute
916
+ # test if rendered Link's <a> tag has a href attribute
921
917
link_href = test_link .get_attribute ("href" )
922
918
self .assertEqual (link_href , 'http://localhost:8050/test-link' )
923
919
924
- #test if callback is only fired once (offset of 2)
920
+ # test if callback is only fired once (offset of 2)
925
921
self .assertEqual (
926
922
call_count .value ,
927
923
3
@@ -1030,7 +1026,7 @@ def test_datepickerrange_updatemodes(self):
1030
1026
@app .callback (
1031
1027
dash .dependencies .Output ('date-picker-range-output' , 'children' ),
1032
1028
[dash .dependencies .Input ('date-picker-range' , 'start_date' ),
1033
- dash .dependencies .Input ('date-picker-range' , 'end_date' )])
1029
+ dash .dependencies .Input ('date-picker-range' , 'end_date' )])
1034
1030
def update_output (start_date , end_date ):
1035
1031
return '{} - {}' .format (start_date , end_date )
1036
1032
@@ -1062,7 +1058,7 @@ def test_interval(self):
1062
1058
])
1063
1059
1064
1060
@app .callback (Output ('output' , 'children' ),
1065
- [Input ('interval' , 'n_intervals' )])
1061
+ [Input ('interval' , 'n_intervals' )])
1066
1062
def update_text (n ):
1067
1063
return "{}" .format (n )
1068
1064
@@ -1093,7 +1089,7 @@ def test_if_interval_can_be_restarted(self):
1093
1089
@app .callback (
1094
1090
Output ('interval' , 'max_intervals' ),
1095
1091
[Input ('start' , 'n_clicks_timestamp' ),
1096
- Input ('stop' , 'n_clicks_timestamp' )])
1092
+ Input ('stop' , 'n_clicks_timestamp' )])
1097
1093
def start_stop (start , stop ):
1098
1094
if start < stop :
1099
1095
return 0
@@ -1494,9 +1490,9 @@ def update_output(input, state):
1494
1490
return 'input="{}", state="{}"' .format (input , state )
1495
1491
1496
1492
self .startServer (app )
1497
- output = lambda : self .driver .find_element_by_id ('output' )
1498
- input = lambda : self .driver .find_element_by_id ('input' )
1499
- state = lambda : self .driver .find_element_by_id ('state' )
1493
+ output = lambda : self .driver .find_element_by_id ('output' ) # noqa: E731
1494
+ input = lambda : self .driver .find_element_by_id ('input' ) # noqa: E731
1495
+ state = lambda : self .driver .find_element_by_id ('state' ) # noqa: E731
1500
1496
1501
1497
# callback gets called with initial input
1502
1498
wait_for (lambda : call_count .value == 1 )
@@ -1559,7 +1555,6 @@ def update_output(value):
1559
1555
call_count .value ,
1560
1556
# an initial call to retrieve the first value
1561
1557
1 +
1562
- # one for each hello world character
1558
+ # one for each hello world character # noqa: W504
1563
1559
len ('hello world' )
1564
1560
)
1565
-
0 commit comments