From 38c6771be0325e81eed275b95693e707c5cfb76a Mon Sep 17 00:00:00 2001 From: hugovk Date: Mon, 30 Jan 2017 09:20:15 +0200 Subject: [PATCH] Load MSP files to test MSP decoder --- Tests/test_file_msp.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tests/test_file_msp.py b/Tests/test_file_msp.py index 5d13132ae..721b4425e 100644 --- a/Tests/test_file_msp.py +++ b/Tests/test_file_msp.py @@ -1,6 +1,6 @@ from helper import unittest, PillowTestCase, hopper -from PIL import Image, MspImagePlugin +from PIL import Image, ImageFile, MspImagePlugin import os @@ -48,14 +48,22 @@ class TestFileMsp(PillowTestCase): @unittest.skipIf(not os.path.exists(EXTRA_DIR), "Extra image files not installed") - def test_others_windows_v2(self): + def test_open_windows_v2(self): + # Arrange + ImageFile.LOAD_TRUNCATED_IMAGES = True files = (os.path.join(EXTRA_DIR, f) for f in os.listdir(EXTRA_DIR) if os.path.splitext(f)[1] == '.msp') for path in files: + + # Act with Image.open(path) as im: + im.load() + + # Assert self.assertEqual(im.mode, "1") self.assertGreater(im.size, (360, 332)) self.assertIsInstance(im, MspImagePlugin.MspImageFile) + ImageFile.LOAD_TRUNCATED_IMAGES = False def test_cannot_save_wrong_mode(self): # Arrange