mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
test failing update
This commit is contained in:
parent
5f9fff0215
commit
426c9d8fc2
|
@ -34,64 +34,59 @@ class TestFileTiffMetadata(PillowTestCase):
|
|||
|
||||
img.save(f, tiffinfo=info)
|
||||
|
||||
for legacy_api in [False, True]:
|
||||
loaded = Image.open(f)
|
||||
loaded.tag.legacy_api = legacy_api
|
||||
loaded = Image.open(f)
|
||||
|
||||
self.assertEqual(loaded.tag[50838],
|
||||
(len(basetextdata + " ?"),) if legacy_api else len(basetextdata + " ?"))
|
||||
self.assertEqual(loaded.tag[50839], basetextdata + " ?")
|
||||
loaded_float = loaded.tag[tag_ids['RollAngle']]
|
||||
if legacy_api:
|
||||
loaded_float = loaded_float[0]
|
||||
self.assertAlmostEqual(loaded_float, floatdata, places=5)
|
||||
loaded_double = loaded.tag[tag_ids['YawAngle']]
|
||||
if legacy_api:
|
||||
loaded_double = loaded_double[0]
|
||||
self.assertAlmostEqual(loaded_double, doubledata)
|
||||
self.assertEqual(loaded.tag[50838], (len(basetextdata + " ?"),))
|
||||
self.assertEqual(loaded.tag_v2[50838], len(basetextdata + " ?"))
|
||||
|
||||
self.assertEqual(loaded.tag[50839], basetextdata + " ?")
|
||||
self.assertEqual(loaded.tag_v2[50839], basetextdata + " ?")
|
||||
|
||||
|
||||
loaded_float = loaded.tag[tag_ids['RollAngle']][0]
|
||||
self.assertAlmostEqual(loaded_float, floatdata, places=5)
|
||||
loaded_double = loaded.tag[tag_ids['YawAngle']][0]
|
||||
self.assertAlmostEqual(loaded_double, doubledata)
|
||||
|
||||
|
||||
def test_read_metadata(self):
|
||||
for legacy_api in [False, True]:
|
||||
img = Image.open('Tests/images/hopper_g4.tif')
|
||||
img.tag.legacy_api = legacy_api
|
||||
img = Image.open('Tests/images/hopper_g4.tif')
|
||||
|
||||
known = {'YResolution': ((4294967295, 113653537),),
|
||||
'PlanarConfiguration': (1,),
|
||||
'BitsPerSample': (1,),
|
||||
'ImageLength': (128,),
|
||||
'Compression': (4,),
|
||||
'FillOrder': (1,),
|
||||
'RowsPerStrip': (128,),
|
||||
'ResolutionUnit': (3,),
|
||||
'PhotometricInterpretation': (0,),
|
||||
'PageNumber': (0, 1),
|
||||
'XResolution': ((4294967295, 113653537),),
|
||||
'ImageWidth': (128,),
|
||||
'Orientation': (1,),
|
||||
'StripByteCounts': (1968,),
|
||||
'SamplesPerPixel': (1,),
|
||||
'StripOffsets': (8,)
|
||||
} if legacy_api else {
|
||||
'YResolution': 4294967295 / 113653537,
|
||||
'PlanarConfiguration': 1,
|
||||
'BitsPerSample': (1,),
|
||||
'ImageLength': 128,
|
||||
'Compression': 4,
|
||||
'FillOrder': 1,
|
||||
'RowsPerStrip': 128,
|
||||
'ResolutionUnit': 3,
|
||||
'PhotometricInterpretation': 0,
|
||||
'PageNumber': (0, 1),
|
||||
'XResolution': 4294967295 / 113653537,
|
||||
'ImageWidth': 128,
|
||||
'Orientation': 1,
|
||||
'StripByteCounts': (1968,),
|
||||
'SamplesPerPixel': 1,
|
||||
'StripOffsets': (8,)
|
||||
}
|
||||
self.assertEqual({'YResolution': 4294967295 / 113653537,
|
||||
'PlanarConfiguration': 1,
|
||||
'BitsPerSample': (1,),
|
||||
'ImageLength': 128,
|
||||
'Compression': 4,
|
||||
'FillOrder': 1,
|
||||
'RowsPerStrip': 128,
|
||||
'ResolutionUnit': 3,
|
||||
'PhotometricInterpretation': 0,
|
||||
'PageNumber': (0, 1),
|
||||
'XResolution': 4294967295 / 113653537,
|
||||
'ImageWidth': 128,
|
||||
'Orientation': 1,
|
||||
'StripByteCounts': (1968,),
|
||||
'SamplesPerPixel': 1,
|
||||
'StripOffsets': (8,)
|
||||
}, img.tag_v2.named())
|
||||
|
||||
self.assertEqual(known, img.tag.named())
|
||||
self.assertEqual({'YResolution': ((4294967295, 113653537),),
|
||||
'PlanarConfiguration': (1,),
|
||||
'BitsPerSample': (1,),
|
||||
'ImageLength': (128,),
|
||||
'Compression': (4,),
|
||||
'FillOrder': (1,),
|
||||
'RowsPerStrip': (128,),
|
||||
'ResolutionUnit': (3,),
|
||||
'PhotometricInterpretation': (0,),
|
||||
'PageNumber': (0, 1),
|
||||
'XResolution': ((4294967295, 113653537),),
|
||||
'ImageWidth': (128,),
|
||||
'Orientation': (1,),
|
||||
'StripByteCounts': (1968,),
|
||||
'SamplesPerPixel': (1,),
|
||||
'StripOffsets': (8,)
|
||||
}, img.tag.named())
|
||||
|
||||
def test_write_metadata(self):
|
||||
""" Test metadata writing through the python code """
|
||||
|
|
Loading…
Reference in New Issue
Block a user