From 8ed2d1ed02e13d57639d1fe2424e5415e9f3ec61 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Sun, 27 Dec 2015 11:27:18 +0000 Subject: [PATCH] Changing the type of the target values --- Tests/test_file_tiff_metadata.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Tests/test_file_tiff_metadata.py b/Tests/test_file_tiff_metadata.py index 9c976e733..f3f310d8b 100644 --- a/Tests/test_file_tiff_metadata.py +++ b/Tests/test_file_tiff_metadata.py @@ -73,7 +73,7 @@ class TestFileTiffMetadata(PillowTestCase): def test_read_metadata(self): img = Image.open('Tests/images/hopper_g4.tif') - self.assertEqual({'YResolution': 4294967295 / 113653537, + self.assertEqual({'YResolution': TiffImagePlugin.IFDRational(4294967295, 113653537), 'PlanarConfiguration': 1, 'BitsPerSample': (1,), 'ImageLength': 128, @@ -83,7 +83,7 @@ class TestFileTiffMetadata(PillowTestCase): 'ResolutionUnit': 3, 'PhotometricInterpretation': 0, 'PageNumber': (0, 1), - 'XResolution': 4294967295 / 113653537, + 'XResolution': TiffImagePlugin.IFDRational(4294967295, 113653537), 'ImageWidth': 128, 'Orientation': 1, 'StripByteCounts': (1968,), @@ -125,7 +125,16 @@ class TestFileTiffMetadata(PillowTestCase): 'StripByteCounts', 'RowsPerStrip', 'PageNumber', 'StripOffsets'] for tag, value in reloaded.items(): - if tag not in ignored: + if tag in ignored: continue + if (type(original[tag]) == tuple + and type(original[tag][0]) == TiffImagePlugin.IFDRational): + # Need to compare element by element in the tuple, + # not comparing tuples of object references + self.assert_deep_equal(original[tag], + value, + "%s didn't roundtrip, %s, %s" % + (tag, original[tag], value)) + else: self.assertEqual(original[tag], value, "%s didn't roundtrip, %s, %s" %