2019-02-03 18:34:53 +03:00
|
|
|
from .helper import PillowTestCase
|
2017-09-17 13:15:59 +03:00
|
|
|
|
|
|
|
from PIL import GdImageFile
|
|
|
|
|
|
|
|
TEST_GD_FILE = "Tests/images/hopper.gd"
|
|
|
|
|
|
|
|
|
|
|
|
class TestFileGd(PillowTestCase):
|
|
|
|
def test_sanity(self):
|
|
|
|
im = GdImageFile.open(TEST_GD_FILE)
|
|
|
|
self.assertEqual(im.size, (128, 128))
|
|
|
|
self.assertEqual(im.format, "GD")
|
|
|
|
|
|
|
|
def test_bad_mode(self):
|
2019-06-13 18:53:42 +03:00
|
|
|
self.assertRaises(ValueError, GdImageFile.open, TEST_GD_FILE, "bad mode")
|
2017-09-17 13:15:59 +03:00
|
|
|
|
|
|
|
def test_invalid_file(self):
|
|
|
|
invalid_file = "Tests/images/flower.jpg"
|
|
|
|
|
|
|
|
self.assertRaises(IOError, GdImageFile.open, invalid_file)
|