Pillow/Tests/test_file_gbr.py

25 lines
587 B
Python
Raw Normal View History

2020-02-12 19:29:19 +03:00
import pytest
from PIL import GbrImagePlugin, Image
2015-07-03 08:03:25 +03:00
2020-02-12 19:29:19 +03:00
from .helper import assert_image_equal
2015-07-03 08:03:25 +03:00
2020-02-12 19:29:19 +03:00
def test_invalid_file():
invalid_file = "Tests/images/flower.jpg"
2015-07-03 09:22:56 +03:00
2020-02-12 19:29:19 +03:00
with pytest.raises(SyntaxError):
GbrImagePlugin.GbrImageFile(invalid_file)
2015-07-03 08:03:25 +03:00
2020-02-12 19:29:19 +03:00
def test_gbr_file():
with Image.open("Tests/images/gbr.gbr") as im:
with Image.open("Tests/images/gbr.png") as target:
assert_image_equal(target, im)
def test_multiples_operation():
with Image.open("Tests/images/gbr.gbr") as im:
rect = (0, 0, 10, 10)
im.crop(rect)
im.crop(rect)