test_data_manager.py 1.22 KB
Newer Older
BO ZHANG's avatar
BO ZHANG committed
1
2
3
4
5
6
7
8
"""
Identifier:     KSC-SJ4-tests/test_data_manager.py
Name:           test_data_manager.py
Description:    data manager unit test
Author:         Bo Zhang
Created:        2022-09-13
Modified-History:
    2022-09-13, Bo Zhang, created
9
    2022-09-29, Bo Zhang, added test for CsstMbiDataManager
BO ZHANG's avatar
BO ZHANG committed
10
"""
11
import os
BO ZHANG's avatar
BO ZHANG committed
12
13
import unittest
from csst_common.data_manager import CsstMbiDataManager
14
from csst_common.params import CSST_PARAMS as CP
BO ZHANG's avatar
BO ZHANG committed
15

BO ZHANG's avatar
BO ZHANG committed
16

17
18
19
20
21
class TestDataManager(unittest.TestCase):
    def setUp(self) -> None:
        self.dm = CsstMbiDataManager.quickstart(ver_sim="C5.2", dir_l1=".", exposure_id=100)

    def test_l0data_existence(self):
22
        self.assertTrue(len(self.dm.available_detectors) == len(CP["mbi"]["detectors"]))
23
24
25
26
27
28
29
30
        self.assertTrue(os.path.exists(self.dm.l0_detector(6)))
        self.assertTrue(os.path.exists(self.dm.l0_log(6)))
        self.assertTrue(os.path.exists(self.dm.l0_cat(6)))
        self.assertTrue(os.path.exists(self.dm.l0_crs(6)))
        self.assertTrue(isinstance(self.dm.l1_detector(6, post="img.fits"), str))
        self.assertTrue(isinstance(self.dm.l1_file(name="some_file.ext", comment="a demo file"), str))


31
32
33
# class TestParams(unittest.TestCase):
#     def test_params(self):
#         self.assertTrue(True)