Initialise __physical_frame = 0 and add pickle roundtrip tell test

This commit is contained in:
Hugo 2020-04-17 11:21:57 +03:00
parent f589f8689f
commit 94751da23e
2 changed files with 12 additions and 0 deletions

View File

@ -82,3 +82,14 @@ def test_pickle_la_mode_with_palette(tmp_path):
im.mode = "PA"
assert im == loaded_im
def test_pickle_tell():
# Arrange
image = Image.open("Tests/images/hopper.webp")
# Act: roundtrip
unpickled_image = pickle.loads(pickle.dumps(image))
# Assert
assert unpickled_image.tell() == 0

View File

@ -40,6 +40,7 @@ class WebPImageFile(ImageFile.ImageFile):
format_description = "WebP image"
__loaded = -1
__logical_frame = 0
__physical_frame = 0
def _open(self):
if not _webp.HAVE_WEBPANIM: