@@ -831,28 +831,21 @@ def test_collection_set_verts_array():
831
831
assert np .array_equal (ap ._codes , atp ._codes )
832
832
833
833
834
- def _fig_to_bytes (fig ):
835
- with io .BytesIO () as bio :
836
- fig .savefig (bio )
837
- return bio .getvalue ()
838
-
839
-
840
834
@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 ):
842
837
t = np .linspace (0 , 16 )
843
838
f1 = np .sin (t )
844
839
f2 = f1 + 0.2
845
840
f3 = f2 .copy ()
846
841
f3 [10 ], f3 [20 ] = f3 [2 ], f3 [20 ]
847
842
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 )
851
845
852
- fig2 , ax2 = plt .subplots ()
846
+ ax2 = fig_test .subplots ()
853
847
coll2 = getattr (ax2 , fname )(t , f1 , f3 )
854
848
coll2 .set_data (t , f1 , f2 )
855
- assert fig1b == _fig_to_bytes (fig2 )
856
849
857
850
858
851
@pytest .mark .parametrize (("t_direction" , "shape" , "where" , "msg" ), [
0 commit comments