| 2126 | |
| 2127 | @pytest.mark.parametrize("dtype", [np.uint8, np.int8, np.int16]) |
| 2128 | def test_imshow_rgb_values_in_valid_range(self, dtype) -> None: |
| 2129 | da = DataArray(np.arange(75, dtype=dtype).reshape((5, 5, 3))) |
| 2130 | _, ax = plt.subplots() |
| 2131 | out = da.plot.imshow(ax=ax).get_array() |
| 2132 | assert out is not None |
| 2133 | actual_dtype = out.dtype |
| 2134 | assert actual_dtype is not None |
| 2135 | assert actual_dtype == np.uint8 |
| 2136 | assert (out[..., :3] == da.values).all() # Compare without added alpha |
| 2137 | assert (out[..., -1] == 255).all() # Compare alpha |
| 2138 | |
| 2139 | @pytest.mark.filterwarnings("ignore:Several dimensions of this array") |
| 2140 | def test_regression_rgb_imshow_dim_size_one(self) -> None: |