Pillow/Tests/test_file_pixar.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
657 B
Python
Raw Normal View History

from __future__ import annotations
2024-01-20 14:23:03 +03:00
2020-02-12 19:29:19 +03:00
import pytest
2017-02-28 09:27:53 +03:00
from PIL import Image, PixarImagePlugin
2020-02-12 19:29:19 +03:00
from .helper import assert_image_similar, hopper
2017-02-28 09:27:53 +03:00
TEST_FILE = "Tests/images/hopper.pxr"
2024-01-27 07:19:43 +03:00
def test_sanity() -> None:
2020-02-12 19:29:19 +03:00
with Image.open(TEST_FILE) as im:
im.load()
assert im.mode == "RGB"
assert im.size == (128, 128)
assert im.format == "PIXAR"
assert im.get_format_mimetype() is None
2017-02-28 09:27:53 +03:00
2020-02-12 19:29:19 +03:00
im2 = hopper()
assert_image_similar(im, im2, 4.8)
2017-02-28 09:27:53 +03:00
2024-01-27 07:19:43 +03:00
def test_invalid_file() -> None:
2020-02-12 19:29:19 +03:00
invalid_file = "Tests/images/flower.jpg"
with pytest.raises(SyntaxError):
PixarImagePlugin.PixarImageFile(invalid_file)