mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-10-27 06:01:15 +03:00
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
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 |