Skip to content

Commit 680f387

Browse files
committed
enable bgr modes for image bytes tests
1 parent 12d626a commit 680f387

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Tests/test_image.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,34 +1045,26 @@ def test_close_graceful(self, caplog: pytest.LogCaptureFixture) -> None:
10451045

10461046

10471047
class TestImageBytes:
1048-
# The BGR modes don't support the methods tested in this class.
1049-
image_modes_not_bgr = [mode for mode in image_modes if "BGR" not in mode[0]]
1050-
image_mode_names_not_bgr = [
1051-
name for name, num_bands, pixelsize in image_modes if "BGR" not in name
1052-
]
1053-
10541048
sample_bytes = bytes(
1055-
range(
1056-
2 * 2 * max(pixelsize for mode, num_bands, pixelsize in image_modes_not_bgr)
1057-
)
1049+
range(2 * 2 * max(pixelsize for mode, num_bands, pixelsize in image_modes))
10581050
)
10591051

1060-
@pytest.mark.parametrize("mode", image_mode_names_not_bgr)
1052+
@pytest.mark.parametrize("mode", image_mode_names)
10611053
def test_roundtrip_bytes_constructor(self, mode: str):
10621054
source_image = hopper(mode)
10631055
source_bytes = source_image.tobytes()
10641056
copy_image = Image.frombytes(mode, source_image.size, source_bytes)
10651057
assert copy_image.tobytes() == source_bytes
10661058

1067-
@pytest.mark.parametrize("mode", image_mode_names_not_bgr)
1059+
@pytest.mark.parametrize("mode", image_mode_names)
10681060
def test_roundtrip_bytes_method(self, mode: str):
10691061
source_image = hopper(mode)
10701062
source_bytes = source_image.tobytes()
10711063
copy_image = Image.new(mode, source_image.size)
10721064
copy_image.frombytes(source_bytes)
10731065
assert copy_image.tobytes() == source_bytes
10741066

1075-
@pytest.mark.parametrize(("mode", "num_bands", "pixelsize"), image_modes_not_bgr)
1067+
@pytest.mark.parametrize(("mode", "num_bands", "pixelsize"), image_modes)
10761068
def test_pixels_after_getdata_putdata(
10771069
self, mode: str, num_bands: int, pixelsize: int
10781070
):

0 commit comments

Comments
 (0)