Pillow/Tests/test_file_pixar.py

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

28 lines
640 B
Python
Raw Normal View History

from __future__ import annotations
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"
2020-02-12 19:29:19 +03:00
def test_sanity():
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
2020-02-12 19:29:19 +03:00
def test_invalid_file():
invalid_file = "Tests/images/flower.jpg"
with pytest.raises(SyntaxError):
PixarImagePlugin.PixarImageFile(invalid_file)