File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,13 @@ def test_16bit_pgm() -> None:
92
92
assert_image_equal_tofile (im , "Tests/images/16_bit_binary_pgm.tiff" )
93
93
94
94
95
+ def test_p4_save (tmp_path : Path ) -> None :
96
+ with Image .open ("Tests/images/hopper_1bit.pbm" ) as im :
97
+ filename = tmp_path / "temp.pbm"
98
+ im .save (filename )
99
+ assert_image_equal_tofile (im , filename )
100
+
101
+
95
102
def test_16bit_pgm_write (tmp_path : Path ) -> None :
96
103
with Image .open ("Tests/images/16_bit_binary.pgm" ) as im :
97
104
filename = tmp_path / "temp.pgm"
@@ -134,6 +141,12 @@ def test_pfm_big_endian(tmp_path: Path) -> None:
134
141
assert_image_equal_tofile (im , filename )
135
142
136
143
144
+ def test_save_unsupported_mode (tmp_path : Path ) -> None :
145
+ im = hopper ("P" )
146
+ with pytest .raises (OSError , match = "cannot write mode P as PPM" ):
147
+ im .save (tmp_path / "out.ppm" )
148
+
149
+
137
150
@pytest .mark .parametrize (
138
151
"data" ,
139
152
[
You can’t perform that action at this time.
0 commit comments