Added .pnm test

This commit is contained in:
Andrew Murray 2019-03-04 15:11:21 +11:00
parent 8f34621c14
commit 873603701f
2 changed files with 11 additions and 1 deletions

BIN
Tests/images/hopper.pnm Normal file

Binary file not shown.

View File

@ -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: