diff --git a/Tests/test_image_data.py b/Tests/test_image_data.py index b45062720fc..6f935b6d40c 100644 --- a/Tests/test_image_data.py +++ b/Tests/test_image_data.py @@ -117,23 +117,19 @@ def test_putdata_mode_BGR(mode: str) -> None: assert list(im.getdata()) == data -def test_putdata_array_B() -> None: - # shouldn't segfault - # see https://github.com/python-pillow/Pillow/issues/1008 - - arr = array("B", [0]) * 15000 - im = Image.new("L", (150, 100)) - im.putdata(arr) - - assert len(im.getdata()) == len(arr) - - -def test_putdata_array_F() -> None: +@pytest.mark.parametrize( + "mode, type, value", + ( + ("L", "B", 0), # B = unsigned char + ("F", "f", 0.0), # f = float + ), +) +def test_putdata_array(mode: str, type: str, value: float) -> None: # shouldn't segfault # see https://github.com/python-pillow/Pillow/issues/1008 - im = Image.new("F", (150, 100)) - arr = array("f", [0.0]) * 15000 + im = Image.new(mode, (150, 100)) + arr = array(type, [value]) * 15000 im.putdata(arr) assert len(im.getdata()) == len(arr)