mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-29 18:23:24 +03:00
imagecms testing
This commit is contained in:
parent
c1d7543156
commit
f18d64c267
46
Tests/test_imagecms_init.py
Normal file
46
Tests/test_imagecms_init.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
import pytest
|
||||
from PIL import ImageCms
|
||||
from PIL.ImageCms import ImageCmsProfile
|
||||
|
||||
def test_ImageCmsProfile_init():
|
||||
# Test with a filename
|
||||
profile_filename = "path/to/profile.icc"
|
||||
profile = ImageCmsProfile(profile_filename)
|
||||
assert profile.filename == profile_filename
|
||||
|
||||
# Test with a file-like object
|
||||
profile_file = open("path/to/profile.icc", "rb")
|
||||
profile = ImageCmsProfile(profile_file)
|
||||
assert profile.filename is None
|
||||
|
||||
# Test with a low-level profile object
|
||||
low_level_profile = core.profile_open(profile_filename)
|
||||
profile = ImageCmsProfile(low_level_profile)
|
||||
assert profile.filename is None
|
||||
|
||||
# Test with an invalid type
|
||||
with pytest.raises(TypeError):
|
||||
ImageCmsProfile(123)
|
||||
|
||||
|
||||
|
||||
|
||||
# def test_ImageCmsProfile_init_win32():
|
||||
# profile_path = "path/to/profile.icc"
|
||||
# profile_bytes = b"ICC_PROFILE_DATA"
|
||||
|
||||
# with open(profile_path, "rb") as f:
|
||||
# profile_data = f.read()
|
||||
|
||||
# with pytest.raises(TypeError):
|
||||
# ImageCmsProfile(profile_path)
|
||||
|
||||
# with pytest.raises(TypeError):
|
||||
# ImageCmsProfile(profile_bytes)
|
||||
|
||||
# profile = ImageCmsProfile(profile_data)
|
||||
|
||||
# assert profile.filename is None
|
||||
# assert profile.profile is not None
|
||||
# assert profile.product_name is None
|
||||
# assert profile.product_info is None
|
Loading…
Reference in New Issue
Block a user