From 55d4160bcc4c17ed5698b1a6e8ccc70466aa3582 Mon Sep 17 00:00:00 2001 From: cgohlke Date: Sun, 29 Dec 2013 20:14:51 -0800 Subject: [PATCH] TST: fix comparison of X/Y Resolution rational numbers --- Tests/test_file_libtiff.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py index 7f7ba1d63..a94257bc0 100644 --- a/Tests/test_file_libtiff.py +++ b/Tests/test_file_libtiff.py @@ -124,11 +124,21 @@ def test_write_metadata(): for tag, value in reloaded.items(): 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(): 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():