mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
added test for metadata count warning
This commit is contained in:
parent
3d22e52a37
commit
c12b9fb4dc
|
@ -239,5 +239,18 @@ class TestFileTiffMetadata(PillowTestCase):
|
|||
reloaded = Image.open(out)
|
||||
self.assertIsInstance(reloaded.tag_v2[34377], bytes)
|
||||
|
||||
def test_too_many_entries(self):
|
||||
ifd = TiffImagePlugin.ImageFileDirectory_v2()
|
||||
|
||||
# 277: ("SamplesPerPixel", SHORT, 1),
|
||||
ifd._tagdata[277] = struct.pack('hh', 4,4)
|
||||
ifd.tagtype[277] = TiffTags.SHORT
|
||||
|
||||
try:
|
||||
self.assert_warning(UserWarning, lambda: ifd[277])
|
||||
except ValueError:
|
||||
self.fail("Invalid Metadata count should not cause a Value Error.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue
Block a user