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='test_calibType Det00',
34 detectorSerial='Det00',
35 calibType="Test Calib")
36 self.calib.updateMetadata()
37 self.calib.fromDataIds([{'exposure': 1234, 'detector': 0, 'filter': 'G'},
38 {'exposure': 1235, 'detector': 0, 'filter': 'G'},
39 {'exposure': 1234, 'detector': 1, 'filter': 'G'},
40 {'exposure': 1235, 'detector': 1, 'filter': 'G'}])
42 def runText(self, textType):
43 filename = tempfile.mktemp()
44 usedFilename = self.calib.writeText(filename + textType)
45 fromText = IsrProvenance.readText(usedFilename)
46 self.assertEqual(self.calib, fromText)
48 def test_Text(self):
49 self.runText('.yaml')
50 self.runText('.ecsv')
52 def test_Fits(self):
53 filename = tempfile.mktemp()
54 usedFilename = self.calib.writeFits(filename + '.fits')
55 fromFits = IsrProvenance.readFits(usedFilename)
56 self.assertEqual(self.calib, fromFits)
58 fromFits.updateMetadata(setDate=True)
59 self.assertNotEqual(self.calib, fromFits)
62class MemoryTester(lsst.utils.tests.MemoryTestCase):
63 pass
66def setup_module(module):
67 lsst.utils.tests.init()
70if __name__ == "__main__": 70 ↛ 71line 70 didn't jump to line 71, because the condition on line 70 was never true
71 import sys
72 setup_module(sys.modules[__name__])
73 unittest.main()