Pillow/Tests/test_image_frombytes.py
2023-02-25 19:10:47 +11:00

18 lines
375 B
Python

import pytest
from PIL import Image
from .helper import assert_image_equal, hopper
@pytest.mark.parametrize("data_type", ("bytes", "memoryview"))
def test_sanity(data_type):
im1 = hopper()
data = im1.tobytes()
if data_type == "memoryview":
data = memoryview(data)
im2 = Image.frombytes(im1.mode, im1.size, data)
assert_image_equal(im1, im2)