Coverage for tests/test_position.py : 28%

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
1import math
2import unittest
4from lsst.ts.observatory.model import ObservatoryPosition
5import lsst.utils.tests
7class ObservatoryPositionTest(unittest.TestCase):
9 def setUp(self):
10 self.ra_truth = 41.010349
11 self.dec_truth = -19.985964
12 self.ang_truth = 175.993874013319
13 self.alt_truth = 79.6715648342188
14 self.az_truth = 353.018554127083
15 self.pa_truth = 173.584814234084
16 self.rot_truth = -2.40905977923582
18 self.timestamp = 1672534239.91224
19 self.ra_rad_truth = math.radians(self.ra_truth)
20 self.dec_rad_truth = math.radians(self.dec_truth)
21 self.ang_rad_truth = math.radians(self.ang_truth)
22 self.band_filter_truth = 'y'
23 self.tracking_truth = True
24 self.alt_rad_truth = math.radians(self.alt_truth)
25 self.az_rad_truth = math.radians(self.az_truth)
26 self.pa_rad_truth = math.radians(self.pa_truth)
27 self.rot_rad_truth = math.radians(self.rot_truth)
29 self.op = ObservatoryPosition(self.timestamp, self.ra_rad_truth,
30 self.dec_rad_truth, self.ang_rad_truth,
31 self.band_filter_truth,
32 self.tracking_truth, self.alt_rad_truth,
33 self.az_rad_truth, self.pa_rad_truth,
34 self.rot_rad_truth)
36 def test_basic_information_after_creation(self):
37 self.assertEqual(self.op.time, self.timestamp)
38 self.assertEqual(self.op.ra, self.ra_truth)
39 self.assertEqual(self.op.dec, self.dec_truth)
40 self.assertEqual(self.op.ang, self.ang_truth)
41 self.assertEqual(self.op.filter, self.band_filter_truth)
42 self.assertTrue(self.op.tracking)
43 self.assertEqual(self.op.alt, self.alt_truth)
44 self.assertEqual(self.op.az, self.az_truth)
45 self.assertEqual(self.op.pa, self.pa_truth)
46 self.assertEqual(self.op.rot, self.rot_truth)
48 def test_string_representation(self):
49 instance_srep = "t=1672534239.9 ra=41.010 dec=-19.986 "\
50 "ang=175.994 filter=y track=True alt=79.672 "\
51 "az=353.019 pa=173.585 rot=-2.409"
52 self.assertEqual(str(self.op), instance_srep)
54class MemoryTestClass(lsst.utils.tests.MemoryTestCase):
55 pass
57def setup_module(module):
58 lsst.utils.tests.init()
60if __name__ == "__main__": 60 ↛ 61line 60 didn't jump to line 61, because the condition on line 60 was never true
61 lsst.utils.tests.init()
62 unittest.main()