Skip to content

Commit 13d6938

Browse files
committed
Added OSS version tests
1 parent bf19a0c commit 13d6938

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

pysiaf/tests/test_oss_version.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python
2+
"""Tests for the pysiaf utils.tools functions.
3+
4+
Authors
5+
-------
6+
7+
Johannes Sahlmann
8+
9+
"""
10+
11+
from astropy.table import Table
12+
import pytest
13+
14+
from ..utils.tools import select_oss_version
15+
from ..iando.read import read_siaf_oss_version
16+
17+
INSTRUMENT_DATA = ["FGS", "MIRI", "NIRCAM", "NIRISS", "NIRSPEC"]
18+
19+
@pytest.mark.parametrize("instrument", INSTRUMENT_DATA)
20+
def test_oss_instrument(instrument):
21+
oss_table = read_siaf_oss_version(instrument)
22+
for row in oss_table:
23+
assert row['InstrName'] == instrument
24+
25+
APERTURE_DATA = [
26+
("FGS", "FGS2_SUB128DIAG", "8.4"),
27+
("FGS", "J-FRAME", None),
28+
("MIRI", "MIRIM_MASK1065", "8.4"),
29+
("MIRI", "MIRIM_TA1550_LL", "8.4"),
30+
("NIRCAM", "NRCA3_FP1", "8.4"),
31+
("NIRCAM", "NRCA4_SUB64P", "11.1"),
32+
("NIRCAM", "NRCA5_SUB160P", None),
33+
("NIRISS", "NIS_AMI2", "8.4"),
34+
("NIRISS", "NIS_SUBAMPCAL", "8.4"),
35+
("NIRSPEC", "NRS_IFU_SLICE12", "8.4"),
36+
("NIRSPEC", "NRS_VIGNETTED_MSA2", "8.4"),
37+
]
38+
39+
@pytest.mark.parametrize("InstrName,AperName,OSS_Version", APERTURE_DATA)
40+
def test_oss_instrument(InstrName, AperName, OSS_Version):
41+
oss_table = read_siaf_oss_version(InstrName)
42+
oss_version = select_oss_version(AperName, oss_table)
43+
if OSS_Version is not None:
44+
assert oss_version == OSS_Version
45+
else:
46+
assert isinstance(oss_version, Table)

0 commit comments

Comments
 (0)