mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
4de5477b61
With the introduction and use of pytest, it is simple and easy to execute specific tests in isolation through documented command line arguments. Either by specifying the module path or through the `-k EXPRESSION` argument. There is no longer any need to provide the boilerplate: if __name__ == '__main__': unittest.main() To every test file. It is simply noise. The pattern remains in test files that aren't named with `test_*` as those files are not discovered and executed by pytest by default.
23 lines
590 B
Python
23 lines
590 B
Python
from .helper import PillowTestCase
|
|
|
|
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):
|
|
self.assertRaises(ValueError,
|
|
GdImageFile.open, TEST_GD_FILE, 'bad mode')
|
|
|
|
def test_invalid_file(self):
|
|
invalid_file = "Tests/images/flower.jpg"
|
|
|
|
self.assertRaises(IOError, GdImageFile.open, invalid_file)
|