Skip to content

Commit

Permalink
Test BGR;* modes
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Oct 6, 2023
1 parent b053e19 commit f654973
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Tests/test_lib_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from PIL import Image

mode_names_not_bgr = (
mode_names = (
"1",
"L",
"LA",
Expand All @@ -21,11 +21,9 @@
"RGBA",
"RGBa",
"RGBX",
# Image.frombytes() doesn't work with BGR modes:
# unknown raw mode for given image mode
# "BGR;15",
# "BGR;16",
# "BGR;24",
"BGR;15",
"BGR;16",
"BGR;24",
"CMYK",
"YCbCr",
"HSV",
Expand Down Expand Up @@ -62,7 +60,7 @@ def test_setmode():
im.im.setmode("RGBABCDE")


@pytest.mark.parametrize("mode", mode_names_not_bgr)
@pytest.mark.parametrize("mode", mode_names)
def test_equal(mode):
num_img_bytes = len(Image.new(mode, (2, 2)).tobytes())
# alternatively, random.randbytes() in Python 3.9
Expand All @@ -87,7 +85,7 @@ def test_not_equal_mode_1():
assert img_a.im != img_b.im


@pytest.mark.parametrize("mode", [mode for mode in mode_names_not_bgr if mode != "1"])
@pytest.mark.parametrize("mode", [mode for mode in mode_names if mode != "1"])
def test_not_equal(mode):
num_img_bytes = len(Image.new(mode, (2, 2)).tobytes())
# alternatively, random.randbytes() in Python 3.9
Expand Down

0 comments on commit f654973

Please sign in to comment.