diff --git a/lib/matplotlib/tests/test_agg.py b/lib/matplotlib/tests/test_agg.py index 5285a24f01f6..a0a8d8ac02f8 100644 --- a/lib/matplotlib/tests/test_agg.py +++ b/lib/matplotlib/tests/test_agg.py @@ -84,7 +84,9 @@ def test_long_path(): fig.savefig(buff, format='png') -@image_comparison(['agg_filter.png'], remove_text=True) +# # Update style when regenerating the test image +@image_comparison(['agg_filter.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_agg_filter(): def smooth1d(x, window_len): # copied from https://scipy-cookbook.readthedocs.io/ diff --git a/lib/matplotlib/tests/test_backend_pdf.py b/lib/matplotlib/tests/test_backend_pdf.py index 8ffca8295ea5..61e4d1f3f85b 100644 --- a/lib/matplotlib/tests/test_backend_pdf.py +++ b/lib/matplotlib/tests/test_backend_pdf.py @@ -22,7 +22,9 @@ from matplotlib.testing._markers import needs_usetex -@image_comparison(['pdf_use14corefonts.pdf']) +# Update style when regenerating the test image +@image_comparison(['pdf_use14corefonts.pdf'], + style=("classic", "_classic_test_patch")) def test_use14corefonts(): rcParams['pdf.use14corefonts'] = True rcParams['font.family'] = 'sans-serif' @@ -306,7 +308,9 @@ def test_pdfpages_fspath(): pdf.savefig(plt.figure()) -@image_comparison(['hatching_legend.pdf']) +# Update style when regenerating the test image +@image_comparison(['hatching_legend.pdf'], + style=("classic", "_classic_test_patch")) def test_hatching_legend(): """Test for correct hatching on patches in legend""" fig = plt.figure(figsize=(1, 2)) @@ -317,7 +321,9 @@ def test_hatching_legend(): fig.legend([a, b, a, b], ["", "", "", ""]) -@image_comparison(['grayscale_alpha.pdf']) +# Update style when regenerating the test image +@image_comparison(['grayscale_alpha.pdf'], + style=("classic", "_classic_test_patch")) def test_grayscale_alpha(): """Masking images with NaN did not work for grayscale images""" x, y = np.ogrid[-2:2:.1, -2:2:.1] @@ -354,7 +360,8 @@ def test_empty_rasterized(): fig.savefig(io.BytesIO(), format="pdf") -@image_comparison(['kerning.pdf']) +# Update style when regenerating the test image +@image_comparison(['kerning.pdf'], style=("classic", "_classic_test_patch")) def test_kerning(): fig = plt.figure() s = "AVAVAVAVAVAVAVAV€AAVV" @@ -387,7 +394,9 @@ def test_glyphs_subset(): assert subfont.get_num_glyphs() == nosubfont.get_num_glyphs() -@image_comparison(["multi_font_type3.pdf"], tol=4.6) +# Update style when regenerating the test image +@image_comparison(["multi_font_type3.pdf"], tol=4.6, + style=("classic", "_classic_test_patch")) def test_multi_font_type3(): fp = fm.FontProperties(family=["WenQuanYi Zen Hei"]) if Path(fm.findfont(fp)).name != "wqy-zenhei.ttc": @@ -400,7 +409,9 @@ def test_multi_font_type3(): fig.text(0.15, 0.475, "There are 几个汉字 in between!") -@image_comparison(["multi_font_type42.pdf"], tol=2.2) +# Update style when regenerating the test image +@image_comparison(["multi_font_type42.pdf"], tol=2.2, + style=("classic", "_classic_test_patch")) def test_multi_font_type42(): fp = fm.FontProperties(family=["WenQuanYi Zen Hei"]) if Path(fm.findfont(fp)).name != "wqy-zenhei.ttc": diff --git a/lib/matplotlib/tests/test_backend_svg.py b/lib/matplotlib/tests/test_backend_svg.py index 78383904c4fd..5c68b1bc41a7 100644 --- a/lib/matplotlib/tests/test_backend_svg.py +++ b/lib/matplotlib/tests/test_backend_svg.py @@ -36,13 +36,16 @@ def test_visibility(): parser.Parse(buf) # this will raise ExpatError if the svg is invalid -@image_comparison(['fill_black_with_alpha.svg'], remove_text=True) +@image_comparison(['fill_black_with_alpha.svg'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_fill_black_with_alpha(): fig, ax = plt.subplots() ax.scatter(x=[0, 0.1, 1], y=[0, 0, 0], c='k', alpha=0.1, s=10000) -@image_comparison(['noscale'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['noscale'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_noscale(): X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1)) Z = np.sin(Y ** 2) @@ -65,7 +68,9 @@ def test_text_urls(): assert expected in buf -@image_comparison(['bold_font_output.svg']) +# Update style when regenerating the test image +@image_comparison(['bold_font_output.svg'], + style=("classic", "_classic_test_patch")) def test_bold_font_output(): fig, ax = plt.subplots() ax.plot(np.arange(10), np.arange(10)) @@ -74,7 +79,9 @@ def test_bold_font_output(): ax.set_title('bold-title', fontweight='bold') -@image_comparison(['bold_font_output_with_none_fonttype.svg']) +# Update style when regenerating the test image +@image_comparison(['bold_font_output_with_none_fonttype.svg'], + style=("classic", "_classic_test_patch")) def test_bold_font_output_with_none_fonttype(): plt.rcParams['svg.fonttype'] = 'none' fig, ax = plt.subplots() diff --git a/lib/matplotlib/tests/test_colorbar.py b/lib/matplotlib/tests/test_colorbar.py index 5ab3ccf13f80..9aeb1c30eb37 100644 --- a/lib/matplotlib/tests/test_colorbar.py +++ b/lib/matplotlib/tests/test_colorbar.py @@ -102,8 +102,10 @@ def _colorbar_extension_length(spacing): return fig +# Update style when regenerating the test image @image_comparison(['colorbar_extensions_shape_uniform.png', - 'colorbar_extensions_shape_proportional.png']) + 'colorbar_extensions_shape_proportional.png'], + style=("classic", "_classic_test_patch")) def test_colorbar_extension_shape(): """Test rectangular colorbar extensions.""" # Remove this line when this test image is regenerated. @@ -114,9 +116,10 @@ def test_colorbar_extension_shape(): _colorbar_extension_shape('proportional') +# Update style when regenerating the test image @image_comparison(['colorbar_extensions_uniform.png', 'colorbar_extensions_proportional.png'], - tol=1.0) + tol=1.0, style=("classic", "_classic_test_patch")) def test_colorbar_extension_length(): """Test variable length colorbar extensions.""" # Remove this line when this test image is regenerated. @@ -152,13 +155,15 @@ def test_colorbar_extension_inverted_axis(orientation, extend, expected): @pytest.mark.parametrize('use_gridspec', [True, False]) +# Update style when regenerating the test image @image_comparison(['cbar_with_orientation', 'cbar_locationing', 'double_cbar', 'cbar_sharing', ], extensions=['png'], remove_text=True, - savefig_kwarg={'dpi': 40}) + savefig_kwarg={'dpi': 40}, + style=("classic", "_classic_test_patch")) def test_colorbar_positioning(use_gridspec): # Remove this line when this test image is regenerated. plt.rcParams['pcolormesh.snap'] = False @@ -233,7 +238,9 @@ def test_colorbar_single_ax_panchor_east(constrained): assert ax.get_anchor() == 'E' -@image_comparison(['contour_colorbar.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['contour_colorbar.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_contour_colorbar(): fig, ax = plt.subplots(figsize=(4, 2)) data = np.arange(1200).reshape(30, 40) - 500 @@ -244,8 +251,10 @@ def test_contour_colorbar(): fig.colorbar(CS, orientation='vertical') +# Update style when regenerating the test image @image_comparison(['cbar_with_subplots_adjust.png'], remove_text=True, - savefig_kwarg={'dpi': 40}) + savefig_kwarg={'dpi': 40}, + style=("classic", "_classic_test_patch")) def test_gridspec_make_colorbar(): plt.figure() data = np.arange(1200).reshape(30, 40) @@ -262,8 +271,10 @@ def test_gridspec_make_colorbar(): plt.subplots_adjust(top=0.95, right=0.95, bottom=0.2, hspace=0.25) +# Update style when regenerating the test image @image_comparison(['colorbar_single_scatter.png'], remove_text=True, - savefig_kwarg={'dpi': 40}) + savefig_kwarg={'dpi': 40}, + style=("classic", "_classic_test_patch")) def test_colorbar_single_scatter(): # Issue #2642: if a path collection has only one entry, # the norm scaling within the colorbar must ensure a diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py index e42206b8cb79..653571fbecc7 100644 --- a/lib/matplotlib/tests/test_contour.py +++ b/lib/matplotlib/tests/test_contour.py @@ -124,7 +124,9 @@ def test_contour_manual_labels(): plt.clabel(cs, manual=pts, fontsize='small', colors=('r', 'g')) -@image_comparison(['contour_manual_colors_and_levels.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['contour_manual_colors_and_levels.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_given_colors_levels_and_extends(): # Remove this line when this test image is regenerated. plt.rcParams['pcolormesh.snap'] = False @@ -211,9 +213,10 @@ def test_labels(): CS.add_label_near(x, y, inline=True, transform=False) +# Update style when regenerating the test image @image_comparison(['contour_corner_mask_False.png', 'contour_corner_mask_True.png'], - remove_text=True) + remove_text=True, style=("classic", "_classic_test_patch")) def test_corner_mask(): n = 60 mask_level = 0.95 diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py index ee07cadef78b..1c8d1e89cda4 100644 --- a/lib/matplotlib/tests/test_figure.py +++ b/lib/matplotlib/tests/test_figure.py @@ -25,8 +25,10 @@ import matplotlib.dates as mdates +# Update style when regenerating the test image @image_comparison(['figure_align_labels'], extensions=['png', 'svg'], - tol=0 if platform.machine() == 'x86_64' else 0.01) + tol=0 if platform.machine() == 'x86_64' else 0.01, + style=("classic", "_classic_test_patch")) def test_align_labels(): fig = plt.figure(layout='tight') gs = gridspec.GridSpec(3, 3) @@ -160,7 +162,8 @@ def test_clf_keyword(): assert [t.get_text() for t in fig2.texts] == [] -@image_comparison(['figure_today']) +# Update style when regenerating the test image +@image_comparison(['figure_today'], style=("classic", "_classic_test_patch")) def test_figure(): # named figure support fig = plt.figure('today') @@ -175,7 +178,8 @@ def test_figure(): plt.close('tomorrow') -@image_comparison(['figure_legend']) +# Update style when regenerating the test image +@image_comparison(['figure_legend'], style=("classic", "_classic_test_patch")) def test_figure_legend(): fig, axs = plt.subplots(2) axs[0].plot([0, 1], [1, 0], label='x', color='g') @@ -272,7 +276,9 @@ def test_add_subplot_invalid(): fig.add_subplot(ax) -@image_comparison(['figure_suptitle']) +# Update style when regenerating the test image +@image_comparison(['figure_suptitle'], + style=("classic", "_classic_test_patch")) def test_suptitle(): fig, _ = plt.subplots() fig.suptitle('hello', color='r') diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index 07852881ebd8..00201d51f51c 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -43,7 +43,9 @@ def test_image_interps(): ax3.set_ylabel('bicubic') -@image_comparison(['interp_alpha.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['interp_alpha.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_alpha_interp(): """Test the interpolation of the alpha channel on RGBA images""" fig, (axl, axr) = plt.subplots(1, 2) @@ -56,8 +58,10 @@ def test_alpha_interp(): axr.imshow(img, interpolation="bilinear") +# Update style when regenerating the test image @image_comparison(['interp_nearest_vs_none'], - extensions=['pdf', 'svg'], remove_text=True) + extensions=['pdf', 'svg'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_interp_nearest_vs_none(): """Test the effect of "nearest" and "none" interpolation""" # Setting dpi to something really small makes the difference very @@ -74,8 +78,10 @@ def test_interp_nearest_vs_none(): ax2.set_title('interpolation nearest') +# Update style when regenerating the test image @pytest.mark.parametrize('suppressComposite', [False, True]) -@image_comparison(['figimage'], extensions=['png', 'pdf']) +@image_comparison(['figimage'], extensions=['png', 'pdf'], + style=("classic", "_classic_test_patch")) def test_figimage(suppressComposite): fig = plt.figure(figsize=(2, 2), dpi=100) fig.suppressComposite = suppressComposite diff --git a/lib/matplotlib/tests/test_lines.py b/lib/matplotlib/tests/test_lines.py index e7002df8a558..d03a25c7780a 100644 --- a/lib/matplotlib/tests/test_lines.py +++ b/lib/matplotlib/tests/test_lines.py @@ -83,7 +83,9 @@ def test_set_line_coll_dash(): ax.contour(np.random.randn(20, 30), linestyles=[(0, (3, 3))]) -@image_comparison(['line_dashes'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['line_dashes'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_line_dashes(): fig, ax = plt.subplots() @@ -122,7 +124,9 @@ def test_valid_linestyles(): line.set_linestyle('aardvark') -@image_comparison(['drawstyle_variants.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['drawstyle_variants.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_drawstyle_variants(): fig, axs = plt.subplots(6) dss = ["default", "steps-mid", "steps-pre", "steps-post", "steps", None] @@ -172,7 +176,9 @@ def test_set_line_coll_dash_image(): ax.contour(np.random.randn(20, 30), linestyles=[(0, (3, 3))]) -@image_comparison(['marker_fill_styles.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['marker_fill_styles.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_marker_fill_styles(): colors = itertools.cycle([[0, 0, 1], 'g', '#ff0000', 'c', 'm', 'y', np.array([0, 0, 0])]) diff --git a/lib/matplotlib/tests/test_patches.py b/lib/matplotlib/tests/test_patches.py index 45bd6b4b06fc..4c002670ecea 100644 --- a/lib/matplotlib/tests/test_patches.py +++ b/lib/matplotlib/tests/test_patches.py @@ -191,7 +191,8 @@ def test_negative_rect(): assert_array_equal(np.roll(neg_vertices, 2, 0), pos_vertices) -@image_comparison(['clip_to_bbox']) +# Update style when regenerating the test image +@image_comparison(['clip_to_bbox'], style=("classic", "_classic_test_patch")) def test_clip_to_bbox(): fig, ax = plt.subplots() ax.set_xlim([-18, 20]) @@ -219,7 +220,9 @@ def test_clip_to_bbox(): ax.add_patch(result_patch) -@image_comparison(['patch_alpha_coloring'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['patch_alpha_coloring'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_patch_alpha_coloring(): """ Test checks that the patch and collection are rendered with the specified @@ -250,7 +253,9 @@ def test_patch_alpha_coloring(): ax.set_ylim([-1, 2]) -@image_comparison(['patch_alpha_override'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['patch_alpha_override'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_patch_alpha_override(): #: Test checks that specifying an alpha attribute for a patch or #: collection will override any alpha component of the facecolor @@ -290,7 +295,9 @@ def test_patch_color_none(): assert c.get_facecolor()[0] == 0 -@image_comparison(['patch_custom_linestyle'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['patch_custom_linestyle'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_patch_custom_linestyle(): #: A test to check that patches and collections accept custom dash #: patterns as linestyle and that they display correctly. @@ -387,8 +394,10 @@ def test_wedge_movement(): assert getattr(w, attr) == new_v +# Update style when regenerating the test image # png needs tol>=0.06, pdf tol>=1.617 -@image_comparison(['wedge_range'], remove_text=True, tol=1.65 if on_win else 0) +@image_comparison(['wedge_range'], remove_text=True, tol=1.65 if on_win else 0, + style=("classic", "_classic_test_patch")) def test_wedge_range(): ax = plt.axes() @@ -500,7 +509,9 @@ def test_multi_color_hatch(): ax.add_patch(r) -@image_comparison(['units_rectangle.png']) +# Update style when regenerating the test image +@image_comparison(['units_rectangle.png'], + style=("classic", "_classic_test_patch")) def test_units_rectangle(): import matplotlib.testing.jpl_units as U U.register() @@ -740,7 +751,9 @@ def test_boxstyle_errors(fmt, match): BoxStyle(fmt) -@image_comparison(baseline_images=['annulus'], extensions=['png']) +# Update style when regenerating the test image +@image_comparison(baseline_images=['annulus'], extensions=['png'], + style=("classic", "_classic_test_patch")) def test_annulus(): fig, ax = plt.subplots() @@ -752,7 +765,9 @@ def test_annulus(): ax.set_aspect('equal') -@image_comparison(baseline_images=['annulus'], extensions=['png']) +# Update style when regenerating the test image +@image_comparison(baseline_images=['annulus'], extensions=['png'], + style=("classic", "_classic_test_patch")) def test_annulus_setters(): fig, ax = plt.subplots() @@ -773,7 +788,9 @@ def test_annulus_setters(): ell.angle = 45 -@image_comparison(baseline_images=['annulus'], extensions=['png']) +# Update style when regenerating the test image +@image_comparison(baseline_images=['annulus'], extensions=['png'], + style=("classic", "_classic_test_patch")) def test_annulus_setters2(): fig, ax = plt.subplots() diff --git a/lib/matplotlib/tests/test_patheffects.py b/lib/matplotlib/tests/test_patheffects.py index 6e09f4e37d6d..3c51b4f80c4d 100644 --- a/lib/matplotlib/tests/test_patheffects.py +++ b/lib/matplotlib/tests/test_patheffects.py @@ -7,7 +7,9 @@ import matplotlib.patches as patches -@image_comparison(['patheffect1'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['patheffect1'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_patheffect1(): ax1 = plt.subplot() ax1.imshow([[1, 2], [2, 3]]) @@ -43,7 +45,8 @@ def test_patheffect2(): foreground="w")]) -@image_comparison(['patheffect3']) +# Update style when regenerating the test image +@image_comparison(['patheffect3'], style=("classic", "_classic_test_patch")) def test_patheffect3(): p1, = plt.plot([1, 3, 5, 4, 3], 'o-b', lw=4) p1.set_path_effects([path_effects.SimpleLineShadow(), @@ -71,7 +74,9 @@ def test_patheffect3(): t.set_path_effects(pe) -@image_comparison(['stroked_text.png']) +# Update style when regenerating the test image +@image_comparison(['stroked_text.png'], + style=("classic", "_classic_test_patch")) def test_patheffects_stroked_text(): text_chunks = [ 'A B C D E F G H I J K L', @@ -136,8 +141,10 @@ def test_collection(): 'edgecolor': 'blue'}) +# Update style when regenerating the test image @image_comparison(['tickedstroke'], remove_text=True, extensions=['png'], - tol=0.22) # Increased tolerance due to fixed clipping. + tol=0.22, # Increased tolerance due to fixed clipping. + style=("classic", "_classic_test_patch")) def test_tickedstroke(): fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(12, 4)) path = Path.unit_circle() @@ -191,7 +198,9 @@ def test_tickedstroke(): ax3.set_ylim(0, 4) -@image_comparison(['spaces_and_newlines.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['spaces_and_newlines.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_patheffects_spaces_and_newlines(): ax = plt.subplot() s1 = " " diff --git a/lib/matplotlib/tests/test_polar.py b/lib/matplotlib/tests/test_polar.py index c51508ae227a..7d2cd1edf657 100644 --- a/lib/matplotlib/tests/test_polar.py +++ b/lib/matplotlib/tests/test_polar.py @@ -70,7 +70,9 @@ def test_polar_coord_annotations(): ax.set_ylim(-20, 20) -@image_comparison(['polar_alignment.png']) +# Update style when regenerating the test image +@image_comparison(['polar_alignment.png'], + style=("classic", "_classic_test_patch")) def test_polar_alignment(): # Test changing the vertical/horizontal alignment of a polar graph. angles = np.arange(0, 360, 90) diff --git a/lib/matplotlib/tests/test_quiver.py b/lib/matplotlib/tests/test_quiver.py index 6e032a54422a..b0b3b8ea4094 100644 --- a/lib/matplotlib/tests/test_quiver.py +++ b/lib/matplotlib/tests/test_quiver.py @@ -99,7 +99,9 @@ def test_zero_headlength(): fig.canvas.draw() # Check that no warning is emitted. -@image_comparison(['quiver_animated_test_image.png']) +# Update style when regenerating the test image +@image_comparison(['quiver_animated_test_image.png'], + style=("classic", "_classic_test_patch")) def test_quiver_animate(): # Tests fix for #2616 fig, ax = plt.subplots() @@ -108,7 +110,9 @@ def test_quiver_animate(): labelpos='W', fontproperties={'weight': 'bold'}) -@image_comparison(['quiver_with_key_test_image.png']) +# Update style when regenerating the test image +@image_comparison(['quiver_with_key_test_image.png'], + style=("classic", "_classic_test_patch")) def test_quiver_with_key(): fig, ax = plt.subplots() ax.margins(0.1) @@ -121,7 +125,9 @@ def test_quiver_with_key(): fontproperties={'weight': 'bold', 'size': 'large'}) -@image_comparison(['quiver_single_test_image.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['quiver_single_test_image.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_quiver_single(): fig, ax = plt.subplots() ax.margins(0.1) @@ -136,7 +142,9 @@ def test_quiver_copy(): assert q0.V[0] == 2.0 -@image_comparison(['quiver_key_pivot.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['quiver_key_pivot.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_quiver_key_pivot(): fig, ax = plt.subplots() @@ -151,7 +159,9 @@ def test_quiver_key_pivot(): ax.quiverkey(q, 0, 0.5, 1, 'W', labelpos='W') -@image_comparison(['quiver_key_xy.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['quiver_key_xy.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_quiver_key_xy(): # With scale_units='xy', ensure quiverkey still matches its quiver. # Note that the quiver and quiverkey lengths depend on the axes aspect @@ -175,7 +185,9 @@ def test_quiver_key_xy(): ax.quiverkey(q, X=x, Y=0.8, U=1, angle=angle, label='', color='b') -@image_comparison(['barbs_test_image.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['barbs_test_image.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_barbs(): x = np.linspace(-5, 5, 5) X, Y = np.meshgrid(x, x) @@ -186,7 +198,9 @@ def test_barbs(): cmap='viridis') -@image_comparison(['barbs_pivot_test_image.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['barbs_pivot_test_image.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_barbs_pivot(): x = np.linspace(-5, 5, 5) X, Y = np.meshgrid(x, x) @@ -197,7 +211,9 @@ def test_barbs_pivot(): ax.scatter(X, Y, s=49, c='black') -@image_comparison(['barbs_test_flip.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['barbs_test_flip.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_barbs_flip(): """Test barbs with an array for flip_barb.""" x = np.linspace(-5, 5, 5) @@ -242,7 +258,9 @@ def test_angles_and_scale(): ax.quiver(X, Y, U, V, angles=phi, scale_units='xy') -@image_comparison(['quiver_xy.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['quiver_xy.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_quiver_xy(): # simple arrow pointing from SW to NE fig, ax = plt.subplots(subplot_kw=dict(aspect='equal')) diff --git a/lib/matplotlib/tests/test_simplification.py b/lib/matplotlib/tests/test_simplification.py index 446fc92993e7..e60078ab4540 100644 --- a/lib/matplotlib/tests/test_simplification.py +++ b/lib/matplotlib/tests/test_simplification.py @@ -17,7 +17,9 @@ # NOTE: All of these tests assume that path.simplify is set to True # (the default) -@image_comparison(['clipping'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['clipping'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_clipping(): t = np.arange(0.0, 2.0, 0.01) s = np.sin(2*np.pi*t) @@ -27,7 +29,9 @@ def test_clipping(): ax.set_ylim((-0.20, -0.28)) -@image_comparison(['overflow'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['overflow'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_overflow(): x = np.array([1.0, 2.0, 3.0, 2.0e5]) y = np.arange(len(x)) @@ -37,7 +41,9 @@ def test_overflow(): ax.set_xlim(2, 6) -@image_comparison(['clipping_diamond'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['clipping_diamond'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_diamond(): x = np.array([0.0, 1.0, 0.0, -1.0, 0.0]) y = np.array([1.0, 0.0, -1.0, 0.0, 1.0]) @@ -231,7 +237,9 @@ def test_sine_plus_noise(): assert simplified.vertices.size == 25240 -@image_comparison(['simplify_curve'], remove_text=True, tol=0.017) +# Update style when regenerating the test image +@image_comparison(['simplify_curve'], remove_text=True, tol=0.017, + style=("classic", "_classic_test_patch")) def test_simplify_curve(): pp1 = patches.PathPatch( Path([(0, 0), (1, 0), (1, 1), (np.nan, 1), (0, 0), (2, 0), (2, 2), @@ -395,7 +403,9 @@ def test_closed_path_clipping(fig_test, fig_ref): fig_ref.add_artist(patches.PathPatch(path, facecolor='none')) -@image_comparison(['hatch_simplify'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['hatch_simplify'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_hatch(): fig, ax = plt.subplots() ax.add_patch(plt.Rectangle((0, 0), 1, 1, fill=False, hatch="/")) @@ -403,7 +413,9 @@ def test_hatch(): ax.set_ylim((0.45, 0.55)) -@image_comparison(['fft_peaks'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['fft_peaks'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_fft_peaks(): fig, ax = plt.subplots() t = np.arange(65536) @@ -465,7 +477,9 @@ def test_throw_rendering_complexity_exceeded(): fig.savefig(io.BytesIO()) -@image_comparison(['clipper_edge'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['clipper_edge'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_clipper(): dat = (0, 1, 0, 2, 0, 3, 0, 4, 0, 5) fig = plt.figure(figsize=(2, 1)) @@ -481,7 +495,9 @@ def test_clipper(): ax.set_xlim(5, 9) -@image_comparison(['para_equal_perp'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['para_equal_perp'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_para_equal_perp(): x = np.array([0, 1, 2, 1, 0, -1, 0, 1] + [1] * 128) y = np.array([1, 1, 2, 1, 0, -1, 0, 0] + [0] * 128) diff --git a/lib/matplotlib/tests/test_subplots.py b/lib/matplotlib/tests/test_subplots.py index 732418f19e2f..44e468b6c2c5 100644 --- a/lib/matplotlib/tests/test_subplots.py +++ b/lib/matplotlib/tests/test_subplots.py @@ -150,7 +150,9 @@ def test_exceptions(): plt.subplots(2, 2, sharey='blah') -@image_comparison(['subplots_offset_text']) +# Update style when regenerating the test image +@image_comparison(['subplots_offset_text'], + style=("classic", "_classic_test_patch")) def test_subplots_offsettext(): x = np.arange(0, 1e10, 1e9) y = np.arange(0, 100, 10)+1e4 diff --git a/lib/matplotlib/tests/test_table.py b/lib/matplotlib/tests/test_table.py index d4f68ea1805d..518c84103c98 100644 --- a/lib/matplotlib/tests/test_table.py +++ b/lib/matplotlib/tests/test_table.py @@ -12,7 +12,9 @@ def test_non_square(): plt.table(cellColours=cellcolors) -@image_comparison(['table_zorder.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['table_zorder.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_zorder(): data = [[66386, 174296], [58230, 381139]] @@ -45,7 +47,9 @@ def test_zorder(): plt.yticks([]) -@image_comparison(['table_labels.png']) +# Update style when regenerating the test image +@image_comparison(['table_labels.png'], + style=("classic", "_classic_test_patch")) def test_label_colours(): dim = 3 @@ -82,7 +86,9 @@ def test_label_colours(): loc='best') -@image_comparison(['table_cell_manipulation.png'], remove_text=True) +# Update style when regenerating the test image +@image_comparison(['table_cell_manipulation.png'], remove_text=True, + style=("classic", "_classic_test_patch")) def test_diff_cell_table(): cells = ('horizontal', 'vertical', 'open', 'closed', 'T', 'R', 'B', 'L') cellText = [['1'] * len(cells)] * 2 @@ -119,7 +125,9 @@ def test_customcell(): assert c == code -@image_comparison(['table_auto_column.png']) +# Update style when regenerating the test image +@image_comparison(['table_auto_column.png'], + style=("classic", "_classic_test_patch")) def test_auto_column(): fig = plt.figure() diff --git a/lib/matplotlib/tests/test_text.py b/lib/matplotlib/tests/test_text.py index f775efa01de4..41ceeba205b2 100644 --- a/lib/matplotlib/tests/test_text.py +++ b/lib/matplotlib/tests/test_text.py @@ -17,7 +17,8 @@ from matplotlib.text import Text -@image_comparison(['font_styles']) +# Update style when regenerating the test image +@image_comparison(['font_styles'], style=("classic", "_classic_test_patch")) def test_font_styles(): def find_matplotlib_font(**kw): @@ -106,7 +107,8 @@ def find_matplotlib_font(**kw): ax.set_yticks([]) -@image_comparison(['multiline']) +# Update style when regenerating the test image +@image_comparison(['multiline'], style=("classic", "_classic_test_patch")) def test_multiline(): plt.figure() ax = plt.subplot(1, 1, 1) @@ -182,7 +184,9 @@ def draw_box(ax, tt): ax.text(1.2, 0.1, 'Bot align, rot20', color='C2') -@image_comparison(['antialiased.png']) +# Update style when regenerating the test image +@image_comparison(['antialiased.png'], + style=("classic", "_classic_test_patch")) def test_antialiasing(): mpl.rcParams['text.antialiased'] = True