@@ -170,34 +170,6 @@ def test_legend_remove():
170170
171171class TestLegendFunction (object ):
172172 # Tests the legend function on the Axes and pyplot.
173-
174- @cleanup
175- def test_old_legend_handler_interface (self ):
176- # Check the deprecated warning is created and that the appropriate
177- # call to the legend handler is made.
178- class AnyObject (object ):
179- pass
180-
181- class AnyObjectHandler (object ):
182- def __call__ (self , legend , orig_handle , fontsize , handlebox ):
183- x0 , y0 = handlebox .xdescent , handlebox .ydescent
184- width , height = handlebox .width , handlebox .height
185- patch = mpatches .Rectangle ([x0 , y0 ], width , height , facecolor = 'red' ,
186- edgecolor = 'black' , hatch = 'xx' , lw = 3 ,
187- transform = handlebox .get_transform ())
188- handlebox .add_artist (patch )
189- return patch
190-
191- with mock .patch ('warnings.warn' ) as warn :
192- plt .legend ([None ], ['My first handler' ],
193- handler_map = {None : AnyObjectHandler ()})
194-
195- warn .assert_called_with ('Legend handers must now implement a '
196- '"legend_artist" method rather than '
197- 'being a callable.' ,
198- MatplotlibDeprecationWarning ,
199- stacklevel = 1 )
200-
201173 @cleanup
202174 def test_legend_handle_label (self ):
203175 lines = plt .plot (range (10 ))
0 commit comments