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:
9292 assert_image_equal_tofile (im , "Tests/images/16_bit_binary_pgm.tiff" )
9393
9494
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+
95102def test_16bit_pgm_write (tmp_path : Path ) -> None :
96103 with Image .open ("Tests/images/16_bit_binary.pgm" ) as im :
97104 filename = tmp_path / "temp.pgm"
@@ -134,6 +141,12 @@ def test_pfm_big_endian(tmp_path: Path) -> None:
134141 assert_image_equal_tofile (im , filename )
135142
136143
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+
137150@pytest .mark .parametrize (
138151 "data" ,
139152 [
You can’t perform that action at this time.
0 commit comments