File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,19 @@ def test_ico(self) -> None:
9393 assert p .image is not None
9494 assert (48 , 48 ) == p .image .size
9595
96+ @pytest .mark .filterwarnings ("ignore:Corrupt EXIF data" )
97+ def test_incremental_tiff (self ) -> None :
98+ with ImageFile .Parser () as p :
99+ with open ("Tests/images/hopper.tif" , "rb" ) as f :
100+ p .feed (f .read (1024 ))
101+
102+ # Check that insufficient data was given in the first feed
103+ assert not p .image
104+
105+ p .feed (f .read ())
106+ assert p .image is not None
107+ assert (128 , 128 ) == p .image .size
108+
96109 @skip_unless_feature ("webp" )
97110 def test_incremental_webp (self ) -> None :
98111 with ImageFile .Parser () as p :
Original file line number Diff line number Diff line change @@ -1432,8 +1432,12 @@ def _setup(self) -> None:
14321432 logger .debug ("- YCbCr subsampling: %s" , self .tag_v2 .get (YCBCRSUBSAMPLING ))
14331433
14341434 # size
1435- xsize = self .tag_v2 .get (IMAGEWIDTH )
1436- ysize = self .tag_v2 .get (IMAGELENGTH )
1435+ try :
1436+ xsize = self .tag_v2 [IMAGEWIDTH ]
1437+ ysize = self .tag_v2 [IMAGELENGTH ]
1438+ except KeyError as e :
1439+ msg = "Missing dimensions"
1440+ raise TypeError (msg ) from e
14371441 if not isinstance (xsize , int ) or not isinstance (ysize , int ):
14381442 msg = "Invalid dimensions"
14391443 raise ValueError (msg )
You can’t perform that action at this time.
0 commit comments