@@ -44,7 +44,10 @@ def test_legend_disabled_when_no_matplotlib_legend():
4444
4545 # Should not have showlegend explicitly set to True
4646 # (Plotly's default behavior when no legend elements exist)
47- assert not hasattr (plotly_fig .layout , 'showlegend' ) or plotly_fig .layout .showlegend != True
47+ assert (
48+ not hasattr (plotly_fig .layout , "showlegend" )
49+ or plotly_fig .layout .showlegend != True
50+ )
4851
4952
5053def test_legend_disabled_when_matplotlib_legend_not_visible ():
@@ -57,15 +60,18 @@ def test_legend_disabled_when_matplotlib_legend_not_visible():
5760 plotly_fig = tls .mpl_to_plotly (fig )
5861
5962 # Should not enable legend when matplotlib legend is hidden
60- assert not hasattr (plotly_fig .layout , 'showlegend' ) or plotly_fig .layout .showlegend != True
63+ assert (
64+ not hasattr (plotly_fig .layout , "showlegend" )
65+ or plotly_fig .layout .showlegend != True
66+ )
6167
6268
6369def test_multiple_traces_native_legend ():
6470 """Test native legend works with multiple traces of different types."""
6571 fig , ax = plt .subplots ()
66- ax .plot ([0 , 1 , 2 ], [0 , 1 , 0 ], '-' , label = "Line" )
67- ax .plot ([0 , 1 , 2 ], [1 , 0 , 1 ], 'o' , label = "Markers" )
68- ax .plot ([0 , 1 , 2 ], [0.5 , 0.5 , 0.5 ], 's-' , label = "Line+Markers" )
72+ ax .plot ([0 , 1 , 2 ], [0 , 1 , 0 ], "-" , label = "Line" )
73+ ax .plot ([0 , 1 , 2 ], [1 , 0 , 1 ], "o" , label = "Markers" )
74+ ax .plot ([0 , 1 , 2 ], [0.5 , 0.5 , 0.5 ], "s-" , label = "Line+Markers" )
6975 ax .legend ()
7076
7177 plotly_fig = tls .mpl_to_plotly (fig )
0 commit comments