Coverage for tests/test_instrument.py : 49%

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 obs_base.
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 <http://www.gnu.org/licenses/>.
22import unittest
24from lsst.obs.base import Instrument, FilterDefinitionCollection
25from lsst.obs.base.instrument_tests import InstrumentTests, InstrumentTestData
27"""Tests of the Instrument class.
28"""
31class DummyCam(Instrument):
33 filterDefinitions = FilterDefinitionCollection()
35 @classmethod
36 def getName(cls):
37 return "DummyCam"
39 def getCamera(self):
40 return None
42 def register(self, registry):
43 """Insert Instrument, physical_filter, and detector entries into a
44 `Registry`.
45 """
46 dataId = {"instrument": self.getName()}
47 registry.insertDimensionData("instrument", dataId)
48 for f in ("dummy_g", "dummy_u"):
49 registry.insertDimensionData("physical_filter",
50 dict(dataId, physical_filter=f, abstract_filter=f[-1]))
51 for d in (1, 2):
52 registry.insertDimensionData("detector",
53 dict(dataId, id=d, full_name=str(d)))
55 def getRawFormatter(self, dataId):
56 # Docstring inherited fromt Instrument.getRawFormatter.
57 return None
59 def writeCuratedCalibrations(self, butler):
60 pass
62 def applyConfigOverrides(self, name, config):
63 pass
66class InstrumentTestCase(InstrumentTests, unittest.TestCase):
67 """Test for Instrument.
68 """
70 instrument = DummyCam()
72 data = InstrumentTestData(name="DummyCam",
73 nDetectors=2,
74 firstDetectorName="1",
75 physical_filters={"dummy_g", "dummy_u"})
77 def test_getCamera(self):
78 """No camera defined in DummyCam"""
79 return
82if __name__ == "__main__": 82 ↛ 83line 82 didn't jump to line 83, because the condition on line 82 was never true
83 unittest.main()