mirror of
https://github.com/python-pillow/Pillow.git
synced 2026-01-11 03:01:29 +03:00
Assert image type
This commit is contained in:
parent
4d511d86ed
commit
4024f0287d
|
|
@ -143,6 +143,7 @@ def test_getiptcinfo_tiff() -> None:
|
||||||
|
|
||||||
# Test with LONG tag type
|
# Test with LONG tag type
|
||||||
with Image.open("Tests/images/hopper.Lab.tif") as im:
|
with Image.open("Tests/images/hopper.Lab.tif") as im:
|
||||||
|
assert isinstance(im, TiffImagePlugin.TiffImageFile)
|
||||||
im.tag_v2.tagtype[TiffImagePlugin.IPTC_NAA_CHUNK] = TiffTags.LONG
|
im.tag_v2.tagtype[TiffImagePlugin.IPTC_NAA_CHUNK] = TiffTags.LONG
|
||||||
iptc = IptcImagePlugin.getiptcinfo(im)
|
iptc = IptcImagePlugin.getiptcinfo(im)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -378,6 +378,7 @@ class TestFileLibTiff(LibTiffTestCase):
|
||||||
im.save(out, tiffinfo=ifd)
|
im.save(out, tiffinfo=ifd)
|
||||||
|
|
||||||
with Image.open(out) as reloaded:
|
with Image.open(out) as reloaded:
|
||||||
|
assert isinstance(reloaded, TiffImagePlugin.TiffImageFile)
|
||||||
assert reloaded.tag_v2[37000] == 100
|
assert reloaded.tag_v2[37000] == 100
|
||||||
|
|
||||||
def test_inknames_tag(
|
def test_inknames_tag(
|
||||||
|
|
|
||||||
|
|
@ -787,7 +787,9 @@ class TestFilePng:
|
||||||
im.save(test_file, exif=im.getexif())
|
im.save(test_file, exif=im.getexif())
|
||||||
|
|
||||||
with Image.open(test_file) as reloaded:
|
with Image.open(test_file) as reloaded:
|
||||||
|
assert isinstance(reloaded, PngImagePlugin.PngImageFile)
|
||||||
exif = reloaded._getexif()
|
exif = reloaded._getexif()
|
||||||
|
assert exif is not None
|
||||||
assert exif[305] == "Adobe Photoshop CS Macintosh"
|
assert exif[305] == "Adobe Photoshop CS Macintosh"
|
||||||
|
|
||||||
def test_exif_argument(self, tmp_path: Path) -> None:
|
def test_exif_argument(self, tmp_path: Path) -> None:
|
||||||
|
|
|
||||||
|
|
@ -1519,6 +1519,9 @@ class Image:
|
||||||
"".join(self.info["Raw profile type exif"].split("\n")[3:])
|
"".join(self.info["Raw profile type exif"].split("\n")[3:])
|
||||||
)
|
)
|
||||||
elif hasattr(self, "tag_v2"):
|
elif hasattr(self, "tag_v2"):
|
||||||
|
from . import TiffImagePlugin
|
||||||
|
|
||||||
|
assert isinstance(self, TiffImagePlugin.TiffImageFile)
|
||||||
self._exif.bigtiff = self.tag_v2._bigtiff
|
self._exif.bigtiff = self.tag_v2._bigtiff
|
||||||
self._exif.endian = self.tag_v2._endian
|
self._exif.endian = self.tag_v2._endian
|
||||||
self._exif.load_from_fp(self.fp, self.tag_v2._offset)
|
self._exif.load_from_fp(self.fp, self.tag_v2._offset)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user