Coverage for tests/test_calibType.py : 41%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This file is part of ip_isr.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
21import unittest
22import tempfile
24import lsst.utils.tests
26from lsst.ip.isr import IsrProvenance
29class IsrCalibCases(lsst.utils.tests.TestCase):
30 """Test unified calibration type.
31 """
32 def setUp(self):
33 self.calib = IsrProvenance(detectorName='testCalibType Det00',
34 detectorId='0',
35 instrument="TestInst",
36 calibType="Test Calib")
37 self.calib.updateMetadata()
38 self.calib.fromDataIds([{'exposure': 1234, 'detector': 0, 'filter': 'G'},
39 {'exposure': 1235, 'detector': 0, 'filter': 'G'},
40 {'exposure': 1234, 'detector': 1, 'filter': 'G'},
41 {'exposure': 1235, 'detector': 1, 'filter': 'G'}])
43 def runText(self, textType):
44 filename = tempfile.mktemp()
45 usedFilename = self.calib.writeText(filename + textType)
46 fromText = IsrProvenance.readText(usedFilename)
47 self.assertEqual(self.calib, fromText)
49 def test_Text(self):
50 self.runText('.yaml')
51 self.runText('.ecsv')
53 def test_Fits(self):
54 filename = tempfile.mktemp()
55 usedFilename = self.calib.writeFits(filename + '.fits')
56 fromFits = IsrProvenance.readFits(usedFilename)
57 self.assertEqual(self.calib, fromFits)
59 fromFits.updateMetadata(setDate=True)
60 self.assertNotEqual(self.calib, fromFits)
63class MemoryTester(lsst.utils.tests.MemoryTestCase):
64 pass
67def setup_module(module):
68 lsst.utils.tests.init()
71if __name__ == "__main__": 71 ↛ 72line 71 didn't jump to line 72, because the condition on line 71 was never true
72 import sys
73 setup_module(sys.modules[__name__])
74 unittest.main()