From e002207c5bbf841906f53738de861a62b8346808 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sat, 27 May 2017 21:55:42 +0300 Subject: [PATCH] Remove function deprecated and warning since 3.0 (1 Oct 2015) --- PIL/TiffImagePlugin.py | 9 --------- Tests/test_file_tiff.py | 18 ++++-------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index f9709e83b..aafcb101d 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -462,15 +462,6 @@ class ImageFileDirectory_v2(collections.MutableMapping): def __str__(self): return str(dict(self)) - def as_dict(self): - """Return a dictionary of the image's tags. - - .. deprecated:: 3.0.0 - """ - warnings.warn("as_dict() is deprecated. " + - "Please use dict(ifd) instead.", DeprecationWarning) - return dict(self) - def named(self): """ :returns: dict of name|key: value diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 1e182fb1a..90976a272 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -274,16 +274,6 @@ class TestFileTiff(PillowTestCase): # Assert self.assertIsInstance(ret, str) - def test_as_dict_deprecation(self): - # Arrange - filename = "Tests/images/pil136.tiff" - im = Image.open(filename) - - self.assert_warning(DeprecationWarning, im.tag_v2.as_dict) - self.assert_warning(DeprecationWarning, im.tag.as_dict) - self.assertEqual(dict(im.tag_v2), im.tag_v2.as_dict()) - self.assertEqual(dict(im.tag), im.tag.as_dict()) - def test_dict(self): # Arrange filename = "Tests/images/pil136.tiff" @@ -484,7 +474,7 @@ class TestFileTiff(PillowTestCase): def test_close_on_load_nonexclusive(self): tmpfile = self.tempfile("temp.tif") - + with Image.open("Tests/images/uint16_1_4660.tif") as im: im.save(tmpfile) @@ -495,7 +485,7 @@ class TestFileTiff(PillowTestCase): im.load() self.assertFalse(fp.closed) - + @unittest.skipUnless(sys.platform.startswith('win32'), "Windows only") class TestFileTiffW32(PillowTestCase): @@ -503,7 +493,7 @@ class TestFileTiffW32(PillowTestCase): tmpfile = self.tempfile("temp.tif") import os - # this is an mmaped file. + # this is an mmaped file. with Image.open("Tests/images/uint16_1_4660.tif") as im: im.save(tmpfile) @@ -516,7 +506,7 @@ class TestFileTiffW32(PillowTestCase): # this closes the mmap im.close() - + # this should not fail, as load should have closed the file pointer, # and close should have closed the mmap os.remove(tmpfile)