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

Commitdc91f4f

Browse files
committed
TST: Increase tolerances for M1 machines
These are mostly just single bit changes in antialiasing portions ofdiagonal lines.
1 parent4854407 commitdc91f4f

24 files changed

+104
-67
lines changed

‎lib/matplotlib/tests/test_arrow_patches.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ def draw_arrow(ax, t, r):
1111
fc="b",ec='k'))
1212

1313

14-
@image_comparison(['fancyarrow_test_image'])
14+
@image_comparison(['fancyarrow_test_image'],
15+
tol=0.012ifplatform.machine()=='arm64'else0)
1516
deftest_fancyarrow():
1617
# Added 0 to test division by zero error described in issue 3930
1718
r= [0.4,0.3,0.2,0.1,0]
@@ -115,7 +116,7 @@ def test_fancyarrow_dash():
115116

116117

117118
@image_comparison(['arrow_styles.png'],style='mpl20',remove_text=True,
118-
tol=0ifplatform.machine()=='x86_64'else0.005)
119+
tol=0ifplatform.machine()=='x86_64'else0.02)
119120
deftest_arrow_styles():
120121
styles=mpatches.ArrowStyle.get_styles()
121122

@@ -147,7 +148,8 @@ def test_arrow_styles():
147148
ax.add_patch(patch)
148149

149150

150-
@image_comparison(['connection_styles.png'],style='mpl20',remove_text=True)
151+
@image_comparison(['connection_styles.png'],style='mpl20',remove_text=True,
152+
tol=0.013ifplatform.machine()=='arm64'else0)
151153
deftest_connection_styles():
152154
styles=mpatches.ConnectionStyle.get_styles()
153155

‎lib/matplotlib/tests/test_axes.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ def test_matshow(fig_test, fig_ref):
237237
'formatter_ticker_003',
238238
'formatter_ticker_004',
239239
'formatter_ticker_005',
240-
])
240+
],
241+
tol=0.031ifplatform.machine()=='arm64'else0)
241242
deftest_formatter_ticker():
242243
importmatplotlib.testing.jpl_unitsasunits
243244
units.register()
@@ -437,7 +438,8 @@ def test_twin_logscale(fig_test, fig_ref, twin):
437438
remove_ticks_and_titles(fig_ref)
438439

439440

440-
@image_comparison(['twin_autoscale.png'])
441+
@image_comparison(['twin_autoscale.png'],
442+
tol=0.009ifplatform.machine()=='arm64'else0)
441443
deftest_twinx_axis_scales():
442444
x=np.array([0,0.5,1])
443445
y=0.5*x
@@ -1232,7 +1234,8 @@ def test_fill_betweenx_input(y, x1, x2):
12321234
ax.fill_betweenx(y,x1,x2)
12331235

12341236

1235-
@image_comparison(['fill_between_interpolate'],remove_text=True)
1237+
@image_comparison(['fill_between_interpolate'],remove_text=True,
1238+
tol=0.012ifplatform.machine()=='arm64'else0)
12361239
deftest_fill_between_interpolate():
12371240
x=np.arange(0.0,2,0.02)
12381241
y1=np.sin(2*np.pi*x)
@@ -1623,7 +1626,7 @@ def test_pcolorauto(fig_test, fig_ref, snap):
16231626
ax.pcolormesh(x2,y2,Z,snap=snap)
16241627

16251628

1626-
@image_comparison(['canonical'])
1629+
@image_comparison(['canonical'],tol=0.02ifplatform.machine()=='arm64'else0)
16271630
deftest_canonical():
16281631
fig,ax=plt.subplots()
16291632
ax.plot([1,2,3])
@@ -3065,7 +3068,8 @@ def test_log_scales_invalid():
30653068
ax.set_ylim(-1,10)
30663069

30673070

3068-
@image_comparison(['stackplot_test_image','stackplot_test_image'])
3071+
@image_comparison(['stackplot_test_image','stackplot_test_image'],
3072+
tol=0.031ifplatform.machine()=='arm64'else0)
30693073
deftest_stackplot():
30703074
fig=plt.figure()
30713075
x=np.linspace(0,10,10)
@@ -4873,7 +4877,8 @@ def test_marker_styles():
48734877
marker=marker,markersize=10+y/5,label=marker)
48744878

48754879

4876-
@image_comparison(['rc_markerfill.png'])
4880+
@image_comparison(['rc_markerfill.png'],
4881+
tol=0.037ifplatform.machine()=='arm64'else0)
48774882
deftest_markers_fillstyle_rcparams():
48784883
fig,ax=plt.subplots()
48794884
x=np.arange(7)
@@ -4896,7 +4901,7 @@ def test_vertex_markers():
48964901

48974902

48984903
@image_comparison(['vline_hline_zorder','errorbar_zorder'],
4899-
tol=0ifplatform.machine()=='x86_64'else0.02)
4904+
tol=0ifplatform.machine()=='x86_64'else0.026)
49004905
deftest_eb_line_zorder():
49014906
x=list(range(10))
49024907

@@ -5455,7 +5460,8 @@ def test_twin_remove(fig_test, fig_ref):
54555460
ax_ref.yaxis.tick_left()
54565461

54575462

5458-
@image_comparison(['twin_spines.png'],remove_text=True)
5463+
@image_comparison(['twin_spines.png'],remove_text=True,
5464+
tol=0.022ifplatform.machine()=='arm64'else0)
54595465
deftest_twin_spines():
54605466

54615467
defmake_patch_spines_invisible(ax):
@@ -5822,7 +5828,7 @@ def test_pie_linewidth_0():
58225828
plt.axis('equal')
58235829

58245830

5825-
@image_comparison(['pie_center_radius.png'],style='mpl20',tol=0.005)
5831+
@image_comparison(['pie_center_radius.png'],style='mpl20',tol=0.007)
58265832
deftest_pie_center_radius():
58275833
# The slices will be ordered and plotted counter-clockwise.
58285834
labels='Frogs','Hogs','Dogs','Logs'
@@ -6008,7 +6014,8 @@ def test_pie_hatch_multi(fig_test, fig_ref):
60086014
[w.set_hatch(hp)forw,hpinzip(wedges,hatch)]
60096015

60106016

6011-
@image_comparison(['set_get_ticklabels.png'])
6017+
@image_comparison(['set_get_ticklabels.png'],
6018+
tol=0.025ifplatform.machine()=='arm64'else0)
60126019
deftest_set_get_ticklabels():
60136020
# test issue 2246
60146021
fig,ax=plt.subplots(2)
@@ -6572,7 +6579,8 @@ def test_loglog():
65726579
ax.tick_params(length=15,width=2,which='minor')
65736580

65746581

6575-
@image_comparison(["test_loglog_nonpos.png"],remove_text=True,style='mpl20')
6582+
@image_comparison(["test_loglog_nonpos.png"],remove_text=True,style='mpl20',
6583+
tol=0.029ifplatform.machine()=='arm64'else0)
65766584
deftest_loglog_nonpos():
65776585
fig,axs=plt.subplots(3,3)
65786586
x=np.arange(1,11)
@@ -7498,8 +7506,8 @@ def test_scatter_empty_data():
74987506
plt.scatter([], [],s=[],c=[])
74997507

75007508

7501-
@image_comparison(['annotate_across_transforms.png'],
7502-
style='mpl20',remove_text=True)
7509+
@image_comparison(['annotate_across_transforms.png'],style='mpl20',remove_text=True,
7510+
tol=0.025ifplatform.machine()=='arm64'else0)
75037511
deftest_annotate_across_transforms():
75047512
x=np.linspace(0,10,200)
75057513
y=np.exp(-x)*np.sin(x)
@@ -7529,7 +7537,8 @@ def inverted(self):
75297537
return_Translation(-self.dx)
75307538

75317539

7532-
@image_comparison(['secondary_xy.png'],style='mpl20')
7540+
@image_comparison(['secondary_xy.png'],style='mpl20',
7541+
tol=0.027ifplatform.machine()=='arm64'else0)
75337542
deftest_secondary_xy():
75347543
fig,axs=plt.subplots(1,2,figsize=(10,5),constrained_layout=True)
75357544

@@ -8785,7 +8794,8 @@ def test_zorder_and_explicit_rasterization():
87858794
fig.savefig(b,format='pdf')
87868795

87878796

8788-
@image_comparison(["preset_clip_paths.png"],remove_text=True,style="mpl20")
8797+
@image_comparison(["preset_clip_paths.png"],remove_text=True,style="mpl20",
8798+
tol=0.027ifplatform.machine()=="arm64"else0)
87898799
deftest_preset_clip_paths():
87908800
fig,ax=plt.subplots()
87918801

‎lib/matplotlib/tests/test_bbox_tight.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
fromioimportBytesIO
2+
importplatform
23

34
importnumpyasnp
45

@@ -43,7 +44,8 @@ def test_bbox_inches_tight():
4344

4445

4546
@image_comparison(['bbox_inches_tight_suptile_legend'],
46-
savefig_kwarg={'bbox_inches':'tight'})
47+
savefig_kwarg={'bbox_inches':'tight'},
48+
tol=0.02ifplatform.machine()=='arm64'else0)
4749
deftest_bbox_inches_tight_suptile_legend():
4850
plt.plot(np.arange(10),label='a straight line')
4951
plt.legend(bbox_to_anchor=(0.9,1),loc='upper left')

‎lib/matplotlib/tests/test_collections.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
fromdatetimeimportdatetime
22
importio
33
importitertools
4+
importplatform
45
importre
56
fromtypesimportSimpleNamespace
67

@@ -388,7 +389,8 @@ def test_barb_limits():
388389
decimal=1)
389390

390391

391-
@image_comparison(['EllipseCollection_test_image.png'],remove_text=True)
392+
@image_comparison(['EllipseCollection_test_image.png'],remove_text=True,
393+
tol=0.021ifplatform.machine()=='arm64'else0)
392394
deftest_EllipseCollection():
393395
# Test basic functionality
394396
fig,ax=plt.subplots()

‎lib/matplotlib/tests/test_colorbar.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,8 @@ def test_colorbar_single_ax_panchor_east(constrained):
234234
assertax.get_anchor()=='E'
235235

236236

237-
@image_comparison(
238-
['contour_colorbar.png'],remove_text=True,
239-
tol=0.01ifplatform.machine()in ('aarch64','ppc64le','s390x')else0)
237+
@image_comparison(['contour_colorbar.png'],remove_text=True,
238+
tol=0ifplatform.machine()=='x86_64'else0.054)
240239
deftest_contour_colorbar():
241240
fig,ax=plt.subplots(figsize=(4,2))
242241
data=np.arange(1200).reshape(30,40)-500

‎lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
importgc
2+
importplatform
3+
24
importnumpyasnp
35
importpytest
46

@@ -195,7 +197,8 @@ def test_constrained_layout9():
195197
fig.suptitle('Test Suptitle',fontsize=28)
196198

197199

198-
@image_comparison(['constrained_layout10.png'])
200+
@image_comparison(['constrained_layout10.png'],
201+
tol=0.032ifplatform.machine()=='arm64'else0)
199202
deftest_constrained_layout10():
200203
"""Test for handling legend outside axis"""
201204
fig,axs=plt.subplots(2,2,layout="constrained")

‎lib/matplotlib/tests/test_contour.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ def test_contour_label_with_disconnected_segments(split_collections):
164164

165165

166166
@pytest.mark.parametrize("split_collections", [False,True])
167-
@image_comparison(['contour_manual_colors_and_levels.png'],remove_text=True)
167+
@image_comparison(['contour_manual_colors_and_levels.png'],remove_text=True,
168+
tol=0.018ifplatform.machine()=='arm64'else0)
168169
deftest_given_colors_levels_and_extends(split_collections):
169170
# Remove this line when this test image is regenerated.
170171
plt.rcParams['pcolormesh.snap']=False

‎lib/matplotlib/tests/test_figure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ def test_clf_keyword():
160160
assert [t.get_text()fortinfig2.texts]== []
161161

162162

163-
@image_comparison(['figure_today'])
163+
@image_comparison(['figure_today'],
164+
tol=0.015ifplatform.machine()=='arm64'else0)
164165
deftest_figure():
165166
# named figure support
166167
fig=plt.figure('today')

‎lib/matplotlib/tests/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ def test_nonuniform_and_pcolor():
14081408

14091409
@image_comparison(
14101410
['rgba_antialias.png'],style='mpl20',remove_text=True,
1411-
tol=0.007ifplatform.machine()in ('aarch64','ppc64le','s390x')else0)
1411+
tol=0ifplatform.machine()=='x86_64'else0.007)
14121412
deftest_rgba_antialias():
14131413
fig,axs=plt.subplots(2,2,figsize=(3.5,3.5),sharex=False,
14141414
sharey=False,constrained_layout=True)

‎lib/matplotlib/tests/test_legend.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def test_legend_label_with_leading_underscore():
151151
assertlen(legend.legend_handles)==0
152152

153153

154-
@image_comparison(['legend_labels_first.png'],remove_text=True)
154+
@image_comparison(['legend_labels_first.png'],remove_text=True,
155+
tol=0.013ifplatform.machine()=='arm64'else0)
155156
deftest_labels_first():
156157
# test labels to left of markers
157158
fig,ax=plt.subplots()
@@ -161,7 +162,8 @@ def test_labels_first():
161162
ax.legend(loc='best',markerfirst=False)
162163

163164

164-
@image_comparison(['legend_multiple_keys.png'],remove_text=True)
165+
@image_comparison(['legend_multiple_keys.png'],remove_text=True,
166+
tol=0.013ifplatform.machine()=='arm64'else0)
165167
deftest_multiple_keys():
166168
# test legend entries with multiple keys
167169
fig,ax=plt.subplots()
@@ -175,7 +177,7 @@ def test_multiple_keys():
175177

176178

177179
@image_comparison(['rgba_alpha.png'],remove_text=True,
178-
tol=0ifplatform.machine()=='x86_64'else0.01)
180+
tol=0ifplatform.machine()=='x86_64'else0.03)
179181
deftest_alpha_rgba():
180182
fig,ax=plt.subplots()
181183
ax.plot(range(10),lw=5)
@@ -184,7 +186,7 @@ def test_alpha_rgba():
184186

185187

186188
@image_comparison(['rcparam_alpha.png'],remove_text=True,
187-
tol=0ifplatform.machine()=='x86_64'else0.01)
189+
tol=0ifplatform.machine()=='x86_64'else0.03)
188190
deftest_alpha_rcparam():
189191
fig,ax=plt.subplots()
190192
ax.plot(range(10),lw=5)
@@ -212,7 +214,7 @@ def test_fancy():
212214

213215

214216
@image_comparison(['framealpha'],remove_text=True,
215-
tol=0ifplatform.machine()=='x86_64'else0.02)
217+
tol=0ifplatform.machine()=='x86_64'else0.024)
216218
deftest_framealpha():
217219
x=np.linspace(1,100,100)
218220
y=x
@@ -523,7 +525,8 @@ def test_figure_legend_outside():
523525
legbb[nn])
524526

525527

526-
@image_comparison(['legend_stackplot.png'])
528+
@image_comparison(['legend_stackplot.png'],
529+
tol=0.031ifplatform.machine()=='arm64'else0)
527530
deftest_legend_stackplot():
528531
"""Test legend for PolyCollection using stackplot."""
529532
# related to #1341, #1943, and PR #3303
@@ -658,8 +661,8 @@ def test_empty_bar_chart_with_legend():
658661
plt.legend()
659662

660663

661-
@image_comparison(['shadow_argument_types.png'],remove_text=True,
662-
style='mpl20')
664+
@image_comparison(['shadow_argument_types.png'],remove_text=True,style='mpl20',
665+
tol=0.028ifplatform.machine()=='arm64'else0)
663666
deftest_shadow_argument_types():
664667
# Test that different arguments for shadow work as expected
665668
fig,ax=plt.subplots()

‎lib/matplotlib/tests/test_lines.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_invalid_line_data():
9898
line.set_ydata(0)
9999

100100

101-
@image_comparison(['line_dashes'],remove_text=True,tol=0.002)
101+
@image_comparison(['line_dashes'],remove_text=True,tol=0.003)
102102
deftest_line_dashes():
103103
# Tolerance introduced after reordering of floating-point operations
104104
# Remove when regenerating the images
@@ -139,7 +139,8 @@ def test_valid_linestyles():
139139
line.set_linestyle('aardvark')
140140

141141

142-
@image_comparison(['drawstyle_variants.png'],remove_text=True)
142+
@image_comparison(['drawstyle_variants.png'],remove_text=True,
143+
tol=0.03ifplatform.machine()=='arm64'else0)
143144
deftest_drawstyle_variants():
144145
fig,axs=plt.subplots(6)
145146
dss= ["default","steps-mid","steps-pre","steps-post","steps",None]

‎lib/matplotlib/tests/test_patches.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
Tests specific to the patches module.
33
"""
4+
importplatform
5+
46
importnumpyasnp
57
fromnumpy.testingimportassert_almost_equal,assert_array_equal
68
importpytest
@@ -15,9 +17,6 @@
1517
collectionsasmcollections,colorsasmcolors,patchesasmpatches,
1618
pathasmpath,transformsasmtransforms,rcParams)
1719

18-
importsys
19-
on_win= (sys.platform=='win32')
20-
2120

2221
deftest_Polygon_close():
2322
#: GitHub issue #1018 identified a bug in the Polygon handling
@@ -438,8 +437,8 @@ def test_wedge_movement():
438437
assertgetattr(w,attr)==new_v
439438

440439

441-
# png needs tol>=0.06, pdf tol>=1.617
442-
@image_comparison(['wedge_range'],remove_text=True,tol=1.65ifon_winelse0)
440+
@image_comparison(['wedge_range'],remove_text=True,
441+
tol=0.009ifplatform.machine()=='arm64'else0)
443442
deftest_wedge_range():
444443
ax=plt.axes()
445444

@@ -564,7 +563,8 @@ def test_units_rectangle():
564563
ax.set_ylim([5*U.km,9*U.km])
565564

566565

567-
@image_comparison(['connection_patch.png'],style='mpl20',remove_text=True)
566+
@image_comparison(['connection_patch.png'],style='mpl20',remove_text=True,
567+
tol=0.024ifplatform.machine()=='arm64'else0)
568568
deftest_connection_patch():
569569
fig, (ax1,ax2)=plt.subplots(1,2)
570570

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp