@@ -657,17 +657,6 @@ def test_jpeg_alpha():
657657 assert corner_pixel == (254 , 0 , 0 )
658658
659659
660- def test_nonuniformimage_setdata ():
661- ax = plt .gca ()
662- im = NonUniformImage (ax )
663- x = np .arange (3 , dtype = float )
664- y = np .arange (4 , dtype = float )
665- z = np .arange (12 , dtype = float ).reshape ((4 , 3 ))
666- im .set_data (x , y , z )
667- x [0 ] = y [0 ] = z [0 , 0 ] = 9.9
668- assert im ._A [0 , 0 ] == im ._Ax [0 ] == im ._Ay [0 ] == 0 , 'value changed'
669-
670-
671660def test_axesimage_setdata ():
672661 ax = plt .gca ()
673662 im = AxesImage (ax )
@@ -686,15 +675,20 @@ def test_figureimage_setdata():
686675 assert im ._A [0 , 0 ] == 0 , 'value changed'
687676
688677
689- def test_pcolorimage_setdata ():
678+ @pytest .mark .parametrize (
679+ "image_cls,x,y,a" , [
680+ (NonUniformImage ,
681+ np .arange (3. ), np .arange (4. ), np .arange (12. ).reshape ((4 , 3 ))),
682+ (PcolorImage ,
683+ np .arange (3. ), np .arange (4. ), np .arange (6. ).reshape ((3 , 2 ))),
684+ ])
685+ def test_setdata_xya (image_cls , x , y , a ):
690686 ax = plt .gca ()
691- im = PcolorImage (ax )
692- x = np .arange (3 , dtype = float )
693- y = np .arange (4 , dtype = float )
694- z = np .arange (6 , dtype = float ).reshape ((3 , 2 ))
695- im .set_data (x , y , z )
696- x [0 ] = y [0 ] = z [0 , 0 ] = 9.9
687+ im = image_cls (ax )
688+ im .set_data (x , y , a )
689+ x [0 ] = y [0 ] = a [0 , 0 ] = 9.9
697690 assert im ._A [0 , 0 ] == im ._Ax [0 ] == im ._Ay [0 ] == 0 , 'value changed'
691+ im .set_data (x , y , a .reshape ((* a .shape , - 1 ))) # Just a smoketest.
698692
699693
700694def test_minimized_rasterized ():
0 commit comments