@@ -891,22 +891,14 @@ def call(*args, **kwargs):
891
891
def test_annotate_offset_fontsize ():
892
892
# Test that offset_fontsize parameter works and uses accurate values
893
893
fig ,ax = plt .subplots ()
894
- # 10 points should be equal to 1 fontsize unit at fontsize=10
895
894
text_coords = ['offset points' ,'offset fontsize' ]
895
+ # 10 points should be equal to 1 fontsize unit at fontsize=10
896
896
xy_text = [(10 ,10 ), (1 ,1 )]
897
- index = 0
898
- points_coords = ''
899
- fontsize_coords = ''
900
- for i in range (2 ):
901
- ann = ax .annotate ('test' ,xy = (0.5 ,0.5 ),
902
- xytext = (xy_text [index ]),
903
- fontsize = '10' ,
904
- xycoords = 'data' ,
905
- textcoords = text_coords [index ])
906
- if i == 0 :
907
- points_coords = str (ann .get_window_extent ())
908
- else :
909
- fontsize_coords = str (ann .get_window_extent ())
910
- index += 1
897
+ anns = [ax .annotate ('test' ,xy = (0.5 ,0.5 ),
898
+ xytext = xy_text [i ],
899
+ fontsize = '10' ,
900
+ xycoords = 'data' ,
901
+ textcoords = text_coords [i ])for i in range (2 )]
902
+ points_coords ,fontsize_coords = [ann .get_window_extent ()for ann in anns ]
911
903
fig .canvas .draw ()
912
- assert points_coords == fontsize_coords
904
+ assert str ( points_coords ) == str ( fontsize_coords )