Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,6 @@
uploader = "github_actions"


modes = (
"1",
"L",
"LA",
"La",
"P",
"PA",
"F",
"I",
"I;16",
"I;16L",
"I;16B",
"I;16N",
"RGB",
"RGBA",
"RGBa",
"RGBX",
"BGR;15",
"BGR;16",
"BGR;24",
"CMYK",
"YCbCr",
"HSV",
"LAB",
)


def upload(a: Image.Image, b: Image.Image) -> str | None:
if uploader == "show":
# local img.show for errors.
Expand Down
9 changes: 4 additions & 5 deletions Tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
is_big_endian,
is_win32,
mark_if_feature_version,
modes,
skip_unless_feature,
)

Expand All @@ -46,7 +45,7 @@ def helper_image_new(mode: str, size: tuple[int, int]) -> Image.Image:


class TestImage:
@pytest.mark.parametrize("mode", modes)
@pytest.mark.parametrize("mode", Image.MODES + ["BGR;15", "BGR;16", "BGR;24"])
def test_image_modes_success(self, mode: str) -> None:
helper_image_new(mode, (1, 1))

Expand Down Expand Up @@ -1027,7 +1026,7 @@ def test_close_graceful(self, caplog: pytest.LogCaptureFixture) -> None:


class TestImageBytes:
@pytest.mark.parametrize("mode", modes)
@pytest.mark.parametrize("mode", Image.MODES + ["BGR;15", "BGR;16", "BGR;24"])
def test_roundtrip_bytes_constructor(self, mode: str) -> None:
im = hopper(mode)
source_bytes = im.tobytes()
Expand All @@ -1039,7 +1038,7 @@ def test_roundtrip_bytes_constructor(self, mode: str) -> None:
reloaded = Image.frombytes(mode, im.size, source_bytes)
assert reloaded.tobytes() == source_bytes

@pytest.mark.parametrize("mode", modes)
@pytest.mark.parametrize("mode", Image.MODES + ["BGR;15", "BGR;16", "BGR;24"])
def test_roundtrip_bytes_method(self, mode: str) -> None:
im = hopper(mode)
source_bytes = im.tobytes()
Expand All @@ -1048,7 +1047,7 @@ def test_roundtrip_bytes_method(self, mode: str) -> None:
reloaded.frombytes(source_bytes)
assert reloaded.tobytes() == source_bytes

@pytest.mark.parametrize("mode", modes)
@pytest.mark.parametrize("mode", Image.MODES + ["BGR;15", "BGR;16", "BGR;24"])
def test_getdata_putdata(self, mode: str) -> None:
if is_big_endian() and mode == "BGR;15":
pytest.xfail("Known failure of BGR;15 on big-endian")
Expand Down
13 changes: 7 additions & 6 deletions Tests/test_image_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from PIL import Image

from .helper import assert_image_equal, hopper, is_win32, modes
from .helper import assert_image_equal, hopper, is_win32

# CFFI imports pycparser which doesn't support PYTHONOPTIMIZE=2
# https://github.com/eliben/pycparser/pull/198#issuecomment-317001670
Expand Down Expand Up @@ -205,12 +205,13 @@ def check(self, mode: str, expected_color_int: int | None = None) -> None:
with pytest.raises(error):
im.getpixel((-1, -1))

@pytest.mark.parametrize("mode", modes)
@pytest.mark.parametrize("mode", Image.MODES)
def test_basic(self, mode: str) -> None:
if mode.startswith("BGR;"):
with pytest.warns(DeprecationWarning):
self.check(mode)
else:
self.check(mode)

@pytest.mark.parametrize("mode", ("BGR;15", "BGR;16", "BGR;24"))
def test_deprecated(self, mode: str) -> None:
with pytest.warns(DeprecationWarning):
self.check(mode)

def test_list(self) -> None:
Expand Down