mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
commit
3dd14368ff
BIN
Tests/images/hopper.pnm
Normal file
BIN
Tests/images/hopper.pnm
Normal file
Binary file not shown.
|
@ -14,6 +14,7 @@ class TestFileIco(PillowTestCase):
|
|||
self.assertEqual(im.mode, "RGBA")
|
||||
self.assertEqual(im.size, (16, 16))
|
||||
self.assertEqual(im.format, "ICO")
|
||||
self.assertEqual(im.get_format_mimetype(), "image/x-icon")
|
||||
|
||||
def test_invalid_file(self):
|
||||
with open("Tests/images/flower.jpg", "rb") as fp:
|
||||
|
|
|
@ -13,6 +13,7 @@ class TestFilePcx(PillowTestCase):
|
|||
self.assertEqual(im2.mode, im.mode)
|
||||
self.assertEqual(im2.size, im.size)
|
||||
self.assertEqual(im2.format, "PCX")
|
||||
self.assertEqual(im2.get_format_mimetype(), "image/x-pcx")
|
||||
self.assert_image_equal(im2, im)
|
||||
|
||||
def test_sanity(self):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from .helper import PillowTestCase
|
||||
from .helper import PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -34,6 +34,16 @@ class TestFilePpm(PillowTestCase):
|
|||
reloaded = Image.open(f)
|
||||
self.assert_image_equal(im, reloaded)
|
||||
|
||||
def test_pnm(self):
|
||||
im = Image.open('Tests/images/hopper.pnm')
|
||||
self.assert_image_similar(im, hopper(), 0.0001)
|
||||
|
||||
f = self.tempfile('temp.pnm')
|
||||
im.save(f)
|
||||
|
||||
reloaded = Image.open(f)
|
||||
self.assert_image_equal(im, reloaded)
|
||||
|
||||
def test_truncated_file(self):
|
||||
path = self.tempfile('temp.pgm')
|
||||
with open(path, 'w') as f:
|
||||
|
|
|
@ -37,6 +37,8 @@ class TestFileTga(PillowTestCase):
|
|||
path_no_ext, origin, "rle" if rle else "raw")
|
||||
|
||||
original_im = Image.open(tga_path)
|
||||
self.assertEqual(original_im.format, "TGA")
|
||||
self.assertEqual(original_im.get_format_mimetype(), "image/x-tga")
|
||||
if rle:
|
||||
self.assertEqual(
|
||||
original_im.info["compression"], "tga_rle")
|
||||
|
|
Loading…
Reference in New Issue
Block a user