From d12acfee849a77bfb4d07c49f3fedc3358f64883 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sun, 8 Feb 2015 19:09:39 +0200 Subject: [PATCH] Test as_dict() directly instead of as string. Fix for PyPy. --- Tests/test_file_tiff.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index ee3e678eb..32aef075e 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -176,12 +176,23 @@ class TestFileTiff(PillowTestCase): # Assert self.assertIsInstance(ret, str) + + def test_as_dict(self): + # Arrange + filename = "Tests/images/pil136.tiff" + im = Image.open(filename) + + # Act + ret = im.ifd.as_dict() + + # Assert + self.assertIsInstance(ret, dict) + self.assertEqual( - ret, - '{256: (55,), 257: (43,), 258: (8, 8, 8, 8), 259: (1,), ' - '262: (2,), 296: (2,), 273: (8,), 338: (1,), 277: (4,), ' - '279: (9460,), 282: ((720000, 10000),), ' - '283: ((720000, 10000),), 284: (1,)}') + ret, {256: (55,), 257: (43,), 258: (8, 8, 8, 8), 259: (1,), + 262: (2,), 296: (2,), 273: (8,), 338: (1,), 277: (4,), + 279: (9460,), 282: ((720000, 10000),), + 283: ((720000, 10000),), 284: (1,)}) def test__delitem__(self): # Arrange