mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Merge pull request #2552 from hugovk/test-mcidas
Test a McIDAS area file
This commit is contained in:
commit
4a8d260d76
|
@ -66,6 +66,7 @@ class McIdasImageFile(ImageFile.ImageFile):
|
|||
|
||||
self.tile = [("raw", (0, 0) + self.size, offset, (rawmode, stride, 1))]
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# registry
|
||||
|
||||
|
|
BIN
Tests/images/cmx3g8_wv_1998.260_0745_mcidas.ara
Normal file
BIN
Tests/images/cmx3g8_wv_1998.260_0745_mcidas.ara
Normal file
Binary file not shown.
BIN
Tests/images/cmx3g8_wv_1998.260_0745_mcidas.png
Normal file
BIN
Tests/images/cmx3g8_wv_1998.260_0745_mcidas.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 298 KiB |
|
@ -1,6 +1,6 @@
|
|||
from helper import unittest, PillowTestCase
|
||||
|
||||
from PIL import McIdasImagePlugin
|
||||
from PIL import Image, McIdasImagePlugin
|
||||
|
||||
|
||||
class TestFileMcIdas(PillowTestCase):
|
||||
|
@ -12,6 +12,24 @@ class TestFileMcIdas(PillowTestCase):
|
|||
lambda:
|
||||
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)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue
Block a user