@@ -1470,17 +1470,26 @@ def test_str_norms(fig_test, fig_ref):
1470
1470
1471
1471
def test__resample_valid_output ():
1472
1472
resample = functools .partial (mpl ._image .resample , transform = Affine2D ())
1473
- with pytest .raises (ValueError , match = "must be a NumPy array " ):
1473
+ with pytest .raises (TypeError , match = "incompatible function arguments " ):
1474
1474
resample (np .zeros ((9 , 9 )), None )
1475
1475
with pytest .raises (ValueError , match = "different dimensionalities" ):
1476
1476
resample (np .zeros ((9 , 9 )), np .zeros ((9 , 9 , 4 )))
1477
- with pytest .raises (ValueError , match = "must be RGBA" ):
1477
+ with pytest .raises (ValueError , match = "different dimensionalities" ):
1478
+ resample (np .zeros ((9 , 9 , 4 )), np .zeros ((9 , 9 )))
1479
+ with pytest .raises (ValueError , match = "3D input array must be RGBA" ):
1480
+ resample (np .zeros ((9 , 9 , 3 )), np .zeros ((9 , 9 , 4 )))
1481
+ with pytest .raises (ValueError , match = "3D output array must be RGBA" ):
1478
1482
resample (np .zeros ((9 , 9 , 4 )), np .zeros ((9 , 9 , 3 )))
1479
- with pytest .raises (ValueError , match = "Mismatched types" ):
1483
+ with pytest .raises (ValueError , match = "mismatched types" ):
1480
1484
resample (np .zeros ((9 , 9 ), np .uint8 ), np .zeros ((9 , 9 )))
1481
1485
with pytest .raises (ValueError , match = "must be C-contiguous" ):
1482
1486
resample (np .zeros ((9 , 9 )), np .zeros ((9 , 9 )).T )
1483
1487
1488
+ out = np .zeros ((9 , 9 ))
1489
+ out .flags .writeable = False
1490
+ with pytest .raises (ValueError , match = "Output array must be writeable" ):
1491
+ resample (np .zeros ((9 , 9 )), out )
1492
+
1484
1493
1485
1494
def test_axesimage_get_shape ():
1486
1495
# generate dummy image to test get_shape method
0 commit comments