Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8bd1824

Browse files
committed
add anntzers listcomp suggestion
1 parent58bd162 commit8bd1824

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

‎lib/matplotlib/tests/test_text.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -891,22 +891,14 @@ def call(*args, **kwargs):
891891
deftest_annotate_offset_fontsize():
892892
# Test that offset_fontsize parameter works and uses accurate values
893893
fig,ax=plt.subplots()
894-
# 10 points should be equal to 1 fontsize unit at fontsize=10
895894
text_coords= ['offset points','offset fontsize']
895+
# 10 points should be equal to 1 fontsize unit at fontsize=10
896896
xy_text= [(10,10), (1,1)]
897-
index=0
898-
points_coords=''
899-
fontsize_coords=''
900-
foriinrange(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-
ifi==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])foriinrange(2)]
902+
points_coords,fontsize_coords= [ann.get_window_extent()foranninanns]
911903
fig.canvas.draw()
912-
assertpoints_coords==fontsize_coords
904+
assertstr(points_coords)==str(fontsize_coords)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp