mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
commit
9fd4450281
|
@ -1098,6 +1098,25 @@ class TestFileLibTiff(LibTiffTestCase):
|
||||||
|
|
||||||
assert_image_similar(base_im, im, 0.7)
|
assert_image_similar(base_im, im, 0.7)
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"test_file",
|
||||||
|
[
|
||||||
|
"Tests/images/old-style-jpeg-compression-no-samplesperpixel.tif",
|
||||||
|
"Tests/images/old-style-jpeg-compression.tif",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_buffering(self, test_file: str) -> None:
|
||||||
|
# load exif first
|
||||||
|
with Image.open(open(test_file, "rb", buffering=1048576)) as im:
|
||||||
|
exif = dict(im.getexif())
|
||||||
|
|
||||||
|
# load image before exif
|
||||||
|
with Image.open(open(test_file, "rb", buffering=1048576)) as im2:
|
||||||
|
im2.load()
|
||||||
|
exif_after_load = dict(im2.getexif())
|
||||||
|
|
||||||
|
assert exif == exif_after_load
|
||||||
|
|
||||||
@pytest.mark.valgrind_known_error(reason="Backtrace in Python Core")
|
@pytest.mark.valgrind_known_error(reason="Backtrace in Python Core")
|
||||||
def test_sampleformat_not_corrupted(self) -> None:
|
def test_sampleformat_not_corrupted(self) -> None:
|
||||||
# Assert that a TIFF image with SampleFormat=UINT tag is not corrupted
|
# Assert that a TIFF image with SampleFormat=UINT tag is not corrupted
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"test_file",
|
|
||||||
[
|
|
||||||
"Tests/images/old-style-jpeg-compression-no-samplesperpixel.tif",
|
|
||||||
"Tests/images/old-style-jpeg-compression.tif",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_libtiff_exif_loading(test_file) -> None:
|
|
||||||
# loading image before exif
|
|
||||||
im1 = Image.open(open(test_file, "rb", buffering=1048576))
|
|
||||||
im1.load()
|
|
||||||
exif1 = dict(im1.getexif())
|
|
||||||
|
|
||||||
# loading exif before image
|
|
||||||
im2 = Image.open(open(test_file, "rb", buffering=1048576))
|
|
||||||
exif2 = dict(im2.getexif())
|
|
||||||
|
|
||||||
assert exif1 == exif2
|
|
Loading…
Reference in New Issue
Block a user