Pillow/Tests/test_image_frombytes.py

18 lines
375 B
Python
Raw Normal View History

import pytest
from PIL import Image
2020-02-12 19:29:19 +03:00
from .helper import assert_image_equal, hopper
@pytest.mark.parametrize("data_type", ("bytes", "memoryview"))
def test_sanity(data_type):
2020-02-12 19:29:19 +03:00
im1 = hopper()
data = im1.tobytes()
if data_type == "memoryview":
data = memoryview(data)
im2 = Image.frombytes(im1.mode, im1.size, data)
2014-06-10 13:10:47 +04:00
2020-02-12 19:29:19 +03:00
assert_image_equal(im1, im2)