MCPcopy Index your code
hub / github.com/pydata/xarray / test_normalize_rgb_one_arg_error

Method test_normalize_rgb_one_arg_error

xarray/tests/test_plot.py:2117–2125  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2115 assert 0 <= arr.min() <= arr.max() <= 1
2116
2117 def test_normalize_rgb_one_arg_error(self) -> None:
2118 da = DataArray(easy_array((5, 5, 3), start=-0.6, stop=1.4))
2119 # If passed one bound that implies all out of range, error:
2120 for vmin, vmax in ((None, -1), (2, None)):
2121 with pytest.raises(ValueError):
2122 da.plot.imshow(vmin=vmin, vmax=vmax)
2123 # If passed two that's just moving the range, *not* an error:
2124 for vmin2, vmax2 in ((-1.2, -1), (2, 2.1)):
2125 da.plot.imshow(vmin=vmin2, vmax=vmax2)
2126
2127 @pytest.mark.parametrize("dtype", [np.uint8, np.int8, np.int16])
2128 def test_imshow_rgb_values_in_valid_range(self, dtype) -> None:

Callers

nothing calls this directly

Calls 3

DataArrayClass · 0.90
easy_arrayFunction · 0.85
imshowMethod · 0.80

Tested by

no test coverage detected