Skip to content

Commit b3599de

Browse files
authored
Merge pull request #6080 from radarhere/gif_test
Test that n_frames and is_animated do not change GIF
2 parents 96516ce + 9006836 commit b3599de

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Tests/test_file_gif.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,22 @@ def test_n_frames():
308308
assert im.is_animated == (n_frames != 1)
309309

310310

311+
def test_no_change():
312+
# Test n_frames does not change the image
313+
with Image.open("Tests/images/dispose_bgnd.gif") as im:
314+
im.seek(1)
315+
expected = im.copy()
316+
assert im.n_frames == 5
317+
assert_image_equal(im, expected)
318+
319+
# Test is_animated does not change the image
320+
with Image.open("Tests/images/dispose_bgnd.gif") as im:
321+
im.seek(3)
322+
expected = im.copy()
323+
assert im.is_animated
324+
assert_image_equal(im, expected)
325+
326+
311327
def test_eoferror():
312328
with Image.open(TEST_GIF) as im:
313329
n_frames = im.n_frames

0 commit comments

Comments
 (0)