File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,23 @@ def test_rgb() -> None:
33
33
assert_image_similar (im , hopper (), 16 )
34
34
35
35
36
+ def test_cannot_read () -> None :
37
+ with open (TEST_FILE , "rb" ) as fp :
38
+ data = fp .read ().split (b"#" )[0 ]
39
+ with pytest .raises (ValueError , match = "cannot read this XPM file" ):
40
+ with Image .open (BytesIO (data )) as im :
41
+ pass
42
+ with pytest .raises (ValueError , match = "cannot read this XPM file" ):
43
+ with Image .open (BytesIO (data + b"invalid" )) as im :
44
+ pass
45
+
46
+
36
47
def test_not_enough_image_data () -> None :
37
48
with open (TEST_FILE , "rb" ) as fp :
38
49
data = fp .read ().split (b"/* pixels */" )[0 ]
39
- with Image .open (BytesIO (data )) as im :
40
- with pytest .raises (ValueError , match = "not enough image data" ):
41
- im .load ()
50
+ with Image .open (BytesIO (data )) as im :
51
+ with pytest .raises (ValueError , match = "not enough image data" ):
52
+ im .load ()
42
53
43
54
44
55
def test_invalid_file () -> None :
You can’t perform that action at this time.
0 commit comments