File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 5
5
from six .moves import xrange
6
6
7
7
import mock
8
- from nose .tools import assert_equal
8
+ from nose .tools import assert_equal , assert_is
9
9
import numpy as np
10
10
11
11
from matplotlib .testing .decorators import image_comparison , cleanup
@@ -113,6 +113,19 @@ def test_legend_expand():
113
113
ax .legend (loc = 3 , mode = mode , ncol = 2 )
114
114
115
115
116
+ @cleanup
117
+ def test_legend_remove ():
118
+ fig = plt .figure ()
119
+ ax = fig .add_subplot (1 , 1 , 1 )
120
+ lines = ax .plot (range (10 ))
121
+ leg = fig .legend (lines , "test" )
122
+ leg .remove ()
123
+ assert_equal (fig .legends , [])
124
+ leg = ax .legend ("test" )
125
+ leg .remove ()
126
+ assert_is (ax .get_legend (), None )
127
+
128
+
116
129
class TestLegendFunction (object ):
117
130
# Tests the legend function on the Axes and pyplot.
118
131
You can’t perform that action at this time.
0 commit comments