forked from python-pillow/Pillow
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_file_mcidas.py
32 lines (22 loc) · 864 Bytes
/
test_file_mcidas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from __future__ import annotations
import pytest
from PIL import Image, McIdasImagePlugin
from .helper import assert_image_equal_tofile
def test_invalid_file() -> None:
invalid_file = "Tests/images/flower.jpg"
with pytest.raises(SyntaxError):
McIdasImagePlugin.McIdasImageFile(invalid_file)
def test_valid_file() -> None:
# 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.tiff"
# Act
with Image.open(test_file) as im:
im.load()
# Assert
assert im.format == "MCIDAS"
assert im.mode == "I"
assert im.size == (1800, 400)
assert_image_equal_tofile(im, saved_file)