2023-02-25 11:10:47 +03:00
|
|
|
import pytest
|
|
|
|
|
2013-02-26 14:28:34 +04:00
|
|
|
from PIL import Image
|
|
|
|
|
2020-02-12 19:29:19 +03:00
|
|
|
from .helper import assert_image_equal, hopper
|
2019-07-06 23:40:53 +03:00
|
|
|
|
2013-02-26 14:28:34 +04:00
|
|
|
|
2023-02-25 11:10:47 +03:00
|
|
|
@pytest.mark.parametrize("data_type", ("bytes", "memoryview"))
|
|
|
|
def test_sanity(data_type):
|
2020-02-12 19:29:19 +03:00
|
|
|
im1 = hopper()
|
2023-02-25 11:10:47 +03:00
|
|
|
|
|
|
|
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)
|