Source code for iCalibrationDB.tests.test_calibration_constant

from unittest import TestCase

from ..calibration_constant import CalibrationConstant
from ..detectors import DetectorTypes


[docs]class TestCalibrationConstant(TestCase):
[docs] def test_defaults(self): cc = CalibrationConstant() self.assertTrue(cc.auto_approve) self.assertIsNone(cc.description) self.assertIsNone(cc.name) self.assertIsNone(cc.device_type_name)
[docs] def test_typing(self): cc = CalibrationConstant() with self.assertRaises(ValueError): cc.device_type_name = "LPD-Type" # this should work cc.device_type_name = DetectorTypes.LPD self.assertEqual(cc.device_type_name, DetectorTypes.LPD)
[docs] def test_to_dict(self): cc = CalibrationConstant() cc.device_type_name = DetectorTypes.AGIPD cc.description = "Some description" with self.assertRaises(AttributeError): d = cc.to_dict() cc.name = "Foo" d = cc.to_dict() self.assertEqual(d, {'flg_auto_approve': True, 'description': 'Some description', 'calibration_name': 'Foo', 'detector_type_name': 'AGIPD-Type'})