Skip to content

Commit d4e05ce

Browse files
committed
fix(comment): #28701 use decorator @timhoffm #28702 (comment)
1 parent db3af64 commit d4e05ce

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

lib/matplotlib/tests/test_collections.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -831,28 +831,21 @@ def test_collection_set_verts_array():
831831
assert np.array_equal(ap._codes, atp._codes)
832832

833833

834-
def _fig_to_bytes(fig):
835-
with io.BytesIO() as bio:
836-
fig.savefig(bio)
837-
return bio.getvalue()
838-
839-
840834
@pytest.mark.parametrize("fname", ["fill_between", "fill_betweenx"])
841-
def test_fbp_collection_set_data(fname):
835+
@check_figures_equal(extensions=["png"])
836+
def test_fbp_collection_set_data(fname, fig_test, fig_ref):
842837
t = np.linspace(0, 16)
843838
f1 = np.sin(t)
844839
f2 = f1 + 0.2
845840
f3 = f2.copy()
846841
f3[10], f3[20] = f3[2], f3[20]
847842

848-
fig1, ax1 = plt.subplots()
849-
getattr(ax1, fname)(t, f1, f2)
850-
fig1b = _fig_to_bytes(fig1)
843+
ax_ref = fig_ref.subplots()
844+
getattr(ax_ref, fname)(t, f1, f2)
851845

852-
fig2, ax2 = plt.subplots()
846+
ax2 = fig_test.subplots()
853847
coll2 = getattr(ax2, fname)(t, f1, f3)
854848
coll2.set_data(t, f1, f2)
855-
assert fig1b == _fig_to_bytes(fig2)
856849

857850

858851
@pytest.mark.parametrize(("t_direction", "shape", "where", "msg"), [

0 commit comments

Comments
 (0)