Coverage for tests/test_location.py : 35%

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
1from __future__ import division
2import math
3import unittest
5import lsst.sims.utils as simsUtils
6from lsst.ts.dateloc import ObservatoryLocation
7import lsst.utils.tests
9class ObservatoryLocationTest(unittest.TestCase):
11 def setUp(self):
12 # Gemini North
13 self.latitude_truth = 19.82396
14 self.longitude_truth = -155.46984
15 self.height_truth = 4213.0
16 self.latitude_rad_truth = math.radians(self.latitude_truth)
17 self.longitude_rad_truth = math.radians(self.longitude_truth)
19 def test_information_after_standard_creation(self):
20 location = ObservatoryLocation(self.latitude_rad_truth,
21 self.longitude_rad_truth,
22 self.height_truth)
23 self.assertEqual(location.latitude, self.latitude_truth)
24 self.assertEqual(location.longitude, self.longitude_truth)
25 self.assertEqual(location.height, self.height_truth)
27 def test_information_after_lsst_configuration(self):
28 location = ObservatoryLocation()
29 location.for_lsst()
30 lsst = simsUtils.Site(name='LSST')
31 self.assertAlmostEqual(location.latitude, lsst.latitude, places=4)
32 self.assertEqual(location.longitude, lsst.longitude)
33 self.assertEqual(location.height, lsst.height)
35 def test_information_after_config_dictionary_configuration(self):
36 condfdict = {
37 'obs_site': {
38 'latitude': self.latitude_truth,
39 'longitude': self.longitude_truth,
40 'height': self.height_truth
41 }
42 }
43 location = ObservatoryLocation()
44 location.configure(condfdict)
45 self.assertEqual(location.latitude_rad, self.latitude_rad_truth)
46 self.assertEqual(location.longitude_rad, self.longitude_rad_truth)
47 self.assertEqual(location.height, self.height_truth)
49 def test_information_after_reconfiguration(self):
50 location = ObservatoryLocation()
51 location.reconfigure(self.latitude_rad_truth,
52 self.longitude_rad_truth,
53 self.height_truth)
54 self.assertEqual(location.latitude_rad, self.latitude_rad_truth)
55 self.assertEqual(location.longitude_rad, self.longitude_rad_truth)
56 self.assertEqual(location.height, self.height_truth)
58 def test_get_configure_dict(self):
59 cd = ObservatoryLocation.get_configure_dict()
60 self.assertEqual(len(cd), 1)
61 self.assertEqual(len(cd["obs_site"]), 3)
63class MemoryTestClass(lsst.utils.tests.MemoryTestCase):
64 pass
66def setup_module(module):
67 lsst.utils.tests.init()
69if __name__ == "__main__": 69 ↛ 70line 69 didn't jump to line 70, because the condition on line 69 was never true
70 lsst.utils.tests.init()
71 unittest.main()