8000 Merge pull request #24675 from oscargus/teststyles_mpl · matplotlib/matplotlib@4fda5ff · GitHub
[go: up one dir, main page]

Skip to content

Commit 4fda5ff

Browse files
authored
Merge pull request #24675 from oscargus/teststyles_mpl
TST: set style in mpl_toolkits to ease later transition
2 parents cca039d + e053c20 commit 4fda5ff

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def test_divider_append_axes():
5959
assert bboxes["top"].x1 == bboxes["main"].x1 == bboxes["bottom"].x1
6060

6161

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

323325

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

338342

343+
# Update style when regenerating the test image
339344
@image_comparison(['anchored_direction_arrows.png'],
340-
tol=0 if platform.machine() == 'x86_64' else 0.01)
345+
tol=0 if platform.machine() == 'x86_64' else 0.01,
346+
style=('classic', '_classic_test_patch'))
341347
def test_anchored_direction_arrows():
342348
fig, ax = plt.subplots()
343349
ax.imshow(np.zeros((10, 10)), interpolation='nearest')
@@ -346,7 +352,9 @@ def test_anchored_direction_arrows():
346352
ax.add_artist(simple_arrow)
347353

348354

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

620628

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

631641

632-
@image_comparison(['insetposition.png'], remove_text=True)
642+
# Update style when regenerating the test image
643+
@image_comparison(['insetposition.png'], remove_text=True,
644+
style=('classic', '_classic_test_patch'))
633645
def test_insetposition():
634646
fig, ax = plt.subplots(figsize=(2, 2))
635647
ax_ins = plt.axes([0, 0, 1, 1])

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1799,8 +1799,9 @@ def test_subfigure_simple():
17991799
ax = sf[1].add_subplot(1, 1, 1, projection='3d', label='other')
18001800

18011801

1802+
# Update style when regenerating the test image
18021803
@image_comparison(baseline_images=['computed_zorder'], remove_text=True,
1803-
extensions=['png'])
1804+
extensions=['png'], style=('classic', '_classic_test_patch'))
18041805
def test_computed_zorder():
18051806
fig = plt.figure()
18061807
ax1 = fig.add_subplot(221, projection='3d')

lib/mpl_toolkits/mplot3d/tests/test_legend3d.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
from mpl_toolkits.mplot3d import art3d
88

99

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

1820

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

2731

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

0 commit comments

Comments
 (0)
0