mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
Merge pull request #462 from cgohlke/patch-3
TST: fix X/Y Resolution didn't roundtrip in test_file_libtiff
This commit is contained in:
commit
9eae73a6d8
|
@ -124,11 +124,21 @@ def test_write_metadata():
|
||||||
|
|
||||||
for tag, value in reloaded.items():
|
for tag, value in reloaded.items():
|
||||||
if tag not in ignored:
|
if tag not in ignored:
|
||||||
assert_equal(original[tag], value, "%s didn't roundtrip" % tag)
|
if tag.endswith('Resolution'):
|
||||||
|
val = original[tag]
|
||||||
|
assert_almost_equal(val[0][0]/val[0][1], value[0][0]/value[0][1],
|
||||||
|
msg="%s didn't roundtrip" % tag)
|
||||||
|
else:
|
||||||
|
assert_equal(original[tag], value, "%s didn't roundtrip" % tag)
|
||||||
|
|
||||||
for tag, value in original.items():
|
for tag, value in original.items():
|
||||||
if tag not in ignored:
|
if tag not in ignored:
|
||||||
assert_equal(value, reloaded[tag], "%s didn't roundtrip" % tag)
|
if tag.endswith('Resolution'):
|
||||||
|
val = reloaded[tag]
|
||||||
|
assert_almost_equal(val[0][0]/val[0][1], value[0][0]/value[0][1],
|
||||||
|
msg="%s didn't roundtrip" % tag)
|
||||||
|
else:
|
||||||
|
assert_equal(value, reloaded[tag], "%s didn't roundtrip" % tag)
|
||||||
|
|
||||||
|
|
||||||
def test_g3_compression():
|
def test_g3_compression():
|
||||||
|
|
|
@ -67,6 +67,12 @@ def assert_equal(a, b, msg=None):
|
||||||
else:
|
else:
|
||||||
failure(msg or "got %r, expected %r" % (a, b))
|
failure(msg or "got %r, expected %r" % (a, b))
|
||||||
|
|
||||||
|
def assert_almost_equal(a, b, msg=None, eps=1e-6):
|
||||||
|
if abs(a-b) < eps:
|
||||||
|
success()
|
||||||
|
else:
|
||||||
|
failure(msg or "got %r, expected %r" % (a, b))
|
||||||
|
|
||||||
def assert_deep_equal(a, b, msg=None):
|
def assert_deep_equal(a, b, msg=None):
|
||||||
try:
|
try:
|
||||||
if len(a) == len(b):
|
if len(a) == len(b):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user