diff --git a/Tests/test_image.py b/Tests/test_image.py index 54abb66438e..d876d09b948 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -696,7 +696,15 @@ def _make_new( @pytest.mark.parametrize("mode", image_modes) def test_pixels_from_new_image_by_color(self, mode: ImageModeInfo) -> None: - color = 123 if mode.num_bands == 1 else tuple(range(mode.num_bands)) + if mode.name in ("BGR;15", "BGR;16"): + # These modes have fewer than 8 bits per band, + # so not all values can be round-tripped. + color = (16, 32, 49) + elif mode.num_bands == 1: + color = 123 + else: + color = tuple(range(mode.num_bands)) + im = Image.new(mode.name, (2, 2), color=color) assert im.getpixel((0, 0)) == color