mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 02:16:19 +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.
31 lines
940 B
Python
31 lines
940 B
Python
from .helper import PillowTestCase
|
|
|
|
from PIL import Image, McIdasImagePlugin
|
|
|
|
|
|
class TestFileMcIdas(PillowTestCase):
|
|
|
|
def test_invalid_file(self):
|
|
invalid_file = "Tests/images/flower.jpg"
|
|
|
|
self.assertRaises(SyntaxError,
|
|
McIdasImagePlugin.McIdasImageFile, invalid_file)
|
|
|
|
def test_valid_file(self):
|
|
# Arrange
|
|
# https://ghrc.nsstc.nasa.gov/hydro/details/cmx3g8
|
|
# https://ghrc.nsstc.nasa.gov/pub/fieldCampaigns/camex3/cmx3g8/browse/
|
|
test_file = "Tests/images/cmx3g8_wv_1998.260_0745_mcidas.ara"
|
|
saved_file = "Tests/images/cmx3g8_wv_1998.260_0745_mcidas.png"
|
|
|
|
# Act
|
|
im = Image.open(test_file)
|
|
im.load()
|
|
|
|
# Assert
|
|
self.assertEqual(im.format, "MCIDAS")
|
|
self.assertEqual(im.mode, "I")
|
|
self.assertEqual(im.size, (1800, 400))
|
|
im2 = Image.open(saved_file)
|
|
self.assert_image_equal(im, im2)
|