Skip to content

TST: set style in mpl_toolkits to ease later transition #24675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def test_divider_append_axes():
assert bboxes["top"].x1 == bboxes["main"].x1 == bboxes["bottom"].x1


@image_comparison(['twin_axes_empty_and_removed'], extensions=["png"], tol=1)
# Update style when regenerating the test image
@image_comparison(['twin_axes_empty_and_removed'], extensions=["png"], tol=1,
style=('classic', '_classic_test_patch'))
def test_twin_axes_empty_and_removed():
# Purely cosmetic font changes (avoid overlap)
mpl.rcParams.update(
Expand Down Expand Up @@ -321,7 +323,9 @@ def test_fill_facecolor():
mark_inset(ax[3], axins, loc1=2, loc2=4, fc="g", ec="0.5", fill=False)


@image_comparison(['zoomed_axes.png', 'inverted_zoomed_axes.png'])
# Update style when regenerating the test image
@image_comparison(['zoomed_axes.png', 'inverted_zoomed_axes.png'],
style=('classic', '_classic_test_patch'))
def test_zooming_with_inverted_axes():
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 2, 3])
Expand All @@ -336,8 +340,10 @@ def test_zooming_with_inverted_axes():
inset_ax.axis([1.4, 1.1, 1.4, 1.1])


# Update style when regenerating the test image
@image_comparison(['anchored_direction_arrows.png'],
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_anchored_direction_arrows():
fig, ax = plt.subplots()
ax.imshow(np.zeros((10, 10)), interpolation='nearest')
Expand All @@ -346,7 +352,9 @@ def test_anchored_direction_arrows():
ax.add_artist(simple_arrow)


@image_comparison(['anchored_direction_arrows_many_args.png'])
# Update style when regenerating the test image
@image_comparison(['anchored_direction_arrows_many_args.png'],
style=('classic', '_classic_test_patch'))
def test_anchored_direction_arrows_many_args():
fig, ax = plt.subplots()
ax.imshow(np.ones((10, 10)))
Expand Down Expand Up @@ -618,7 +626,9 @@ def test_auto_adjustable():
assert tbb.y1 == pytest.approx(fig.bbox.height - pad * fig.dpi)


@image_comparison(['rgb_axes.png'], remove_text=True)
# Update style when regenerating the test image
@image_comparison(['rgb_axes.png'], remove_text=True,
style=('classic', '_classic_test_patch'))
def test_rgb_axes():
fig = plt.figure()
ax = RGBAxes(fig, (0.1, 0.1, 0.8, 0.8), pad=0.1)
Expand All @@ -629,7 +639,9 @@ def test_rgb_axes():
ax.imshow_rgb(r, g, b, interpolation='none')


@image_comparison(['insetposition.png'], remove_text=True)
# Update style when regenerating the test image
@image_comparison(['insetposition.png'], remove_text=True,
style=('classic', '_classic_test_patch'))
def test_insetposition():
fig, ax = plt.subplots(figsize=(2, 2))
ax_ins = plt.axes([0, 0, 1, 1])
Expand Down
3 changes: 2 additions & 1 deletion lib/mpl_toolkits/mplot3d/tests/test_axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1799,8 +1799,9 @@ def test_subfigure_simple():
ax = sf[1].add_subplot(1, 1, 1, projection='3d', label='other')


# Update style when regenerating the test image
@image_comparison(baseline_images=['computed_zorder'], remove_text=True,
extensions=['png'])
extensions=['png'], style=('classic', '_classic_test_patch'))
def test_computed_zorder():
fig = plt.figure()
ax1 = fig.add_subplot(221, projection='3d')
Expand Down
12 changes: 9 additions & 3 deletions lib/mpl_toolkits/mplot3d/tests/test_legend3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from mpl_toolkits.mplot3d import art3d


@image_comparison(['legend_plot.png'], remove_text=True)
# Update style when regenerating the test image
@image_comparison(['legend_plot.png'], remove_text=True,
style=('classic', '_classic_test_patch'))
def test_legend_plot():
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
x = np.arange(10)
Expand All @@ -16,7 +18,9 @@ def test_legend_plot():
ax.legend()


@image_comparison(['legend_bar.png'], remove_text=True)
# Update style when regenerating the test image
@image_comparison(['legend_bar.png'], remove_text=True,
style=('classic', '_classic_test_patch'))
def test_legend_bar():
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
x = np.arange(10)
Expand All @@ -25,7 +29,9 @@ def test_legend_bar():
ax.legend([b1[0], b2[0]], ['up', 'down'])


@image_comparison(['fancy.png'], remove_text=True)
# Update style when regenerating the test image
@image_comparison(['fancy.png'], remove_text=True,
style=('classic', '_classic_test_patch'))
def test_fancy():
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
ax.plot(np.arange(10), np.full(10, 5), np.full(10, 5), 'o--', label='line')
Expand Down