Source code for iCalibrationDB.tests.test_known_constants

from unittest import TestCase

from ..known_constants import (BadPixels, Noise, Offset, RelativeGain,
                               Constants)
from ..detectors import DetectorTypes


[docs]class TestKnownConstants(TestCase): base_constants = (BadPixels, Noise, Offset, RelativeGain)
[docs] def test_base_constants(self): for klass in self.base_constants: constant = klass() self.assertEqual(constant.auto_approve, True) self.assertEqual(constant.name, klass.__name__) self.assertIsNotNone(constant.description) self.assertIsNone(constant.device_type_name)
[docs] def test_detector_constants(self): for detector in DetectorTypes: dclass = getattr(Constants, detector.name) for klass in self.base_constants: klassname = klass.__name__ dklass = getattr(dclass, klassname) constant = dklass() self.assertEqual(constant.auto_approve, True) self.assertEqual(constant.device_type_name, detector) constant.data = 1 d = constant.to_dict()