mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Image.core.open_ppm has been removed. Test the Storage.c fix with an alternate method. Assert that the ordinary opener rejects the negative size in the PPM file
This commit is contained in:
parent
445451c0b9
commit
b3ad80a2bd
|
@ -45,15 +45,13 @@ class TestFilePpm(PillowTestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_neg_ppm(self):
|
def test_neg_ppm(self):
|
||||||
"""test_neg_ppm
|
# Storage.c accepted negative values for xsize, ysize. the
|
||||||
|
# internal open_ppm function didn't check for sanity but it
|
||||||
|
# has been removed. The default opener doesn't accept negative
|
||||||
|
# sizes.
|
||||||
|
|
||||||
Storage.c accepted negative values for xsize, ysize.
|
with self.assertRaises(IOError):
|
||||||
open_ppm is a core debugging item that doesn't check any parameters for
|
Image.open('Tests/images/negative_size.ppm')
|
||||||
sanity.
|
|
||||||
"""
|
|
||||||
|
|
||||||
with self.assertRaises(ValueError):
|
|
||||||
Image.core.open_ppm('Tests/images/negative_size.ppm')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -248,6 +248,18 @@ class TestImage(PillowTestCase):
|
||||||
|
|
||||||
self.assertTrue(Image.new('RGB', (1,1)))
|
self.assertTrue(Image.new('RGB', (1,1)))
|
||||||
|
|
||||||
|
def test_storage_neg(self):
|
||||||
|
# Storage.c accepted negative values for xsize, ysize. Was
|
||||||
|
# test_neg_ppm, but the core function for that has been
|
||||||
|
# removed Calling directly into core to test the error in
|
||||||
|
# Storage.c, rather than the size check above
|
||||||
|
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
Image.core.fill('RGB', (2,-2), (0,0,0))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user