Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test BGR;* modes #10

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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