@@ -46,6 +46,19 @@ def test_closed_file():
4646 im .close ()
4747
4848
49+ def test_seek_after_close ():
50+ im = Image .open ("Tests/images/iss634.gif" )
51+ im .load ()
52+ im .close ()
53+
54+ with pytest .raises (ValueError ):
55+ im .is_animated
56+ with pytest .raises (ValueError ):
57+ im .n_frames
58+ with pytest .raises (ValueError ):
59+ im .seek (1 )
60+
61+
4962def test_context_manager ():
5063 with warnings .catch_warnings ():
5164 with Image .open (TEST_GIF ) as im :
@@ -794,6 +807,9 @@ def test_comment(tmp_path):
794807 with Image .open (out ) as reread :
795808 assert reread .info ["comment" ] == im .info ["comment" ].encode ()
796809
810+ # Test that GIF89a is used for comments
811+ assert reread .info ["version" ] == b"GIF89a"
812+
797813
798814def test_comment_over_255 (tmp_path ):
799815 out = str (tmp_path / "temp.gif" )
@@ -804,15 +820,23 @@ def test_comment_over_255(tmp_path):
804820 im .info ["comment" ] = comment
805821 im .save (out )
806822 with Image .open (out ) as reread :
807-
808823 assert reread .info ["comment" ] == comment
809824
825+ # Test that GIF89a is used for comments
826+ assert reread .info ["version" ] == b"GIF89a"
827+
810828
811829def test_zero_comment_subblocks ():
812830 with Image .open ("Tests/images/hopper_zero_comment_subblocks.gif" ) as im :
813831 assert_image_equal_tofile (im , TEST_GIF )
814832
815833
834+ def test_read_multiple_comment_blocks ():
835+ with Image .open ("Tests/images/multiple_comments.gif" ) as im :
836+ # Multiple comment blocks in a frame are separated not concatenated
837+ assert im .info ["comment" ] == b"Test comment 1\n Test comment 2"
838+
839+
816840def test_write_comment (tmp_path ):
817841 out = str (tmp_path / "temp.gif" )
818842 with Image .open ("Tests/images/dispose_prev.gif" ) as im :
0 commit comments