@@ -380,21 +380,28 @@ def test_palette() -> None:
380
380
assert_image_equal_tofile (im , "Tests/images/transparent.gif" )
381
381
382
382
383
+ def test_unsupported_header_size () -> None :
384
+ with pytest .raises (OSError , match = "Unsupported header size 0" ):
385
+ with Image .open (BytesIO (b"DDS " + b"\x00 " * 4 )):
386
+ pass
387
+
388
+
383
389
def test_unsupported_bitcount () -> None :
384
- with pytest .raises (OSError ):
390
+ with pytest .raises (OSError , match = "Unsupported bitcount 24 for 131072" ):
385
391
with Image .open ("Tests/images/unsupported_bitcount.dds" ):
386
392
pass
387
393
388
394
389
395
@pytest .mark .parametrize (
390
- "test_file" ,
396
+ "test_file, message " ,
391
397
(
392
- "Tests/images/unimplemented_dxgi_format.dds" ,
393
- "Tests/images/unimplemented_pfflags.dds" ,
398
+ ("Tests/images/unimplemented_dxgi_format.dds" , "Unimplemented DXGI format 93" ),
399
+ ("Tests/images/unimplemented_pixel_format.dds" , "Unimplemented pixel format 0" ),
400
+ ("Tests/images/unimplemented_pfflags.dds" , "Unknown pixel format flags 8" ),
394
401
),
395
402
)
396
- def test_not_implemented (test_file : str ) -> None :
397
- with pytest .raises (NotImplementedError ):
403
+ def test_not_implemented (test_file : str , message : str ) -> None :
404
+ with pytest .raises (NotImplementedError , match = message ):
398
405
with Image .open (test_file ):
399
406
pass
400
407
0 commit comments