Skip to content

Commit 5c7249c

Browse files
committed
enable bgr modes for image bytes tests
1 parent 12d626a commit 5c7249c

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Tests/test_image.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,34 +1045,28 @@ 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(
10551049
range(
1056-
2 * 2 * max(pixelsize for mode, num_bands, pixelsize in image_modes_not_bgr)
1050+
2 * 2 * max(pixelsize for mode, num_bands, pixelsize in image_modes)
10571051
)
10581052
)
10591053

1060-
@pytest.mark.parametrize("mode", image_mode_names_not_bgr)
1054+
@pytest.mark.parametrize("mode", image_mode_names)
10611055
def test_roundtrip_bytes_constructor(self, mode: str):
10621056
source_image = hopper(mode)
10631057
source_bytes = source_image.tobytes()
10641058
copy_image = Image.frombytes(mode, source_image.size, source_bytes)
10651059
assert copy_image.tobytes() == source_bytes
10661060

1067-
@pytest.mark.parametrize("mode", image_mode_names_not_bgr)
1061+
@pytest.mark.parametrize("mode", image_mode_names)
10681062
def test_roundtrip_bytes_method(self, mode: str):
10691063
source_image = hopper(mode)
10701064
source_bytes = source_image.tobytes()
10711065
copy_image = Image.new(mode, source_image.size)
10721066
copy_image.frombytes(source_bytes)
10731067
assert copy_image.tobytes() == source_bytes
10741068

1075-
@pytest.mark.parametrize(("mode", "num_bands", "pixelsize"), image_modes_not_bgr)
1069+
@pytest.mark.parametrize(("mode", "num_bands", "pixelsize"), image_modes)
10761070
def test_pixels_after_getdata_putdata(
10771071
self, mode: str, num_bands: int, pixelsize: int
10781072
):

0 commit comments

Comments
 (0)