File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 12
12
import matplotlib .collections as mcollections
13
13
from matplotlib .legend_handler import HandlerTuple
14
14
import matplotlib .legend as mlegend
15
+ from matplotlib .cbook .deprecation import MatplotlibDeprecationWarning
15
16
16
17
17
18
def test_legend_ordereddict ():
@@ -511,3 +512,30 @@ def test_legend_title_fontsize():
511
512
ax .plot (range (10 ))
512
513
leg = ax .legend (title = 'Aardvark' , title_fontsize = 22 )
513
514
assert leg .get_title ().get_fontsize () == 22
515
+
516
+
517
+ def test_get_set_draggable ():
518
+ legend = plt .legend ()
519
+ assert not legend .get_draggable ()
520
+ legend .set_draggable (True )
521
+ assert legend .get_draggable ()
522
+ legend .set_draggable (False )
523
+ assert not legend .get_draggable ()
524
+
525
+
526
+ def test_draggable ():
527
+ legend = plt .legend ()
528
+ with pytest .warns (MatplotlibDeprecationWarning ):
529
+ legend .draggable (True )
530
+ assert legend .get_draggable ()
531
+ with pytest .warns (MatplotlibDeprecationWarning ):
532
+ legend .draggable (False )
533
+ assert not legend .get_draggable ()
534
+
535
+ # test toggle
536
+ with pytest .warns (MatplotlibDeprecationWarning ):
537
+ legend .draggable ()
538
+ assert legend .get_draggable ()
539
+ with pytest .warns (MatplotlibDeprecationWarning ):
540
+ legend .draggable ()
541
+ assert not legend .get_draggable ()
You can’t perform that action at this time.
0 commit comments