mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 02:16:19 +03:00
Removed use of spaces in TIFF kwargs, deprecated in 2.7
This commit is contained in:
parent
badbff1b99
commit
41e492b026
|
@ -1378,11 +1378,6 @@ def _save(im, fp, filename):
|
||||||
(DATE_TIME, "date_time"),
|
(DATE_TIME, "date_time"),
|
||||||
(ARTIST, "artist"),
|
(ARTIST, "artist"),
|
||||||
(COPYRIGHT, "copyright")]:
|
(COPYRIGHT, "copyright")]:
|
||||||
name_with_spaces = name.replace("_", " ")
|
|
||||||
if "_" in name and name_with_spaces in im.encoderinfo:
|
|
||||||
warnings.warn("%r is deprecated; use %r instead" %
|
|
||||||
(name_with_spaces, name), DeprecationWarning)
|
|
||||||
ifd[key] = im.encoderinfo[name.replace("_", " ")]
|
|
||||||
if name in im.encoderinfo:
|
if name in im.encoderinfo:
|
||||||
ifd[key] = im.encoderinfo[name]
|
ifd[key] = im.encoderinfo[name]
|
||||||
|
|
||||||
|
|
|
@ -399,25 +399,6 @@ class TestFileTiff(PillowTestCase):
|
||||||
self.assertEqual(im.tag_v2[X_RESOLUTION], 72)
|
self.assertEqual(im.tag_v2[X_RESOLUTION], 72)
|
||||||
self.assertEqual(im.tag_v2[Y_RESOLUTION], 36)
|
self.assertEqual(im.tag_v2[Y_RESOLUTION], 36)
|
||||||
|
|
||||||
def test_deprecation_warning_with_spaces(self):
|
|
||||||
kwargs = {'resolution unit': 'inch',
|
|
||||||
'x resolution': 36,
|
|
||||||
'y resolution': 72}
|
|
||||||
filename = self.tempfile("temp.tif")
|
|
||||||
self.assert_warning(DeprecationWarning,
|
|
||||||
lambda: hopper("RGB").save(filename, **kwargs))
|
|
||||||
from PIL.TiffImagePlugin import X_RESOLUTION, Y_RESOLUTION
|
|
||||||
|
|
||||||
im = Image.open(filename)
|
|
||||||
|
|
||||||
# legacy interface
|
|
||||||
self.assertEqual(im.tag[X_RESOLUTION][0][0], 36)
|
|
||||||
self.assertEqual(im.tag[Y_RESOLUTION][0][0], 72)
|
|
||||||
|
|
||||||
# v2 interface
|
|
||||||
self.assertEqual(im.tag_v2[X_RESOLUTION], 36)
|
|
||||||
self.assertEqual(im.tag_v2[Y_RESOLUTION], 72)
|
|
||||||
|
|
||||||
def test_lzw(self):
|
def test_lzw(self):
|
||||||
# Act
|
# Act
|
||||||
im = Image.open("Tests/images/hopper_lzw.tif")
|
im = Image.open("Tests/images/hopper_lzw.tif")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user