Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing tests with Pillow version >= 7.2.0 #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/s_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import time
import unittest

import PIL
from PIL import Image
import piexif
from piexif import _common, ImageIFD, ExifIFD, GPSIFD, TAGS, InvalidImageDataError
Expand Down Expand Up @@ -580,6 +581,17 @@ def test_print_exif(self):
# test utility methods----------------------------------------------

def _compare_value(self, v1, v2):
if isinstance(v2, PIL.TiffImagePlugin.IFDRational):
v2 = (v2.numerator, v2.denominator)
if isinstance(v2, tuple):
converted_v2 = []
for el in v2:
if isinstance(el, PIL.TiffImagePlugin.IFDRational):
converted_v2.append((el.numerator, el.denominator))
else:
converted_v2.append(el)
v2 = tuple(converted_v2)

if type(v1) != type(v2):
if isinstance(v1, tuple):
self.assertEqual(pack_byte(*v1), v2)
Expand Down