mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16:16 +03:00
Merge pull request #4942 from radarhere/del
Fixed bug in Exif __delitem__
This commit is contained in:
commit
68c6740343
|
@ -650,12 +650,14 @@ class TestImage:
|
|||
with Image.open("Tests/images/exif-72dpi-int.jpg") as im: # Little endian
|
||||
exif = im.getexif()
|
||||
assert 258 not in exif
|
||||
assert 274 in exif
|
||||
assert 40960 in exif
|
||||
assert exif[40963] == 450
|
||||
assert exif[11] == "gThumb 3.0.1"
|
||||
|
||||
out = str(tmp_path / "temp.jpg")
|
||||
exif[258] = 8
|
||||
del exif[274]
|
||||
del exif[40960]
|
||||
exif[40963] = 455
|
||||
exif[11] = "Pillow test"
|
||||
|
@ -663,6 +665,7 @@ class TestImage:
|
|||
with Image.open(out) as reloaded:
|
||||
reloaded_exif = reloaded.getexif()
|
||||
assert reloaded_exif[258] == 8
|
||||
assert 274 not in reloaded_exif
|
||||
assert 40960 not in reloaded_exif
|
||||
assert reloaded_exif[40963] == 455
|
||||
assert reloaded_exif[11] == "Pillow test"
|
||||
|
|
|
@ -3466,7 +3466,8 @@ class Exif(MutableMapping):
|
|||
def __delitem__(self, tag):
|
||||
if self._info is not None and tag in self._info:
|
||||
del self._info[tag]
|
||||
del self._data[tag]
|
||||
else:
|
||||
del self._data[tag]
|
||||
|
||||
def __iter__(self):
|
||||
keys = set(self._data)
|
||||
|
|
Loading…
Reference in New Issue
Block a user