Hide keyboard shortcuts

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 astro_metadata_translator. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (http://www.lsst.org). 

6# See the LICENSE file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# Use of this source code is governed by a 3-clause BSD-style 

10# license that can be found in the LICENSE file. 

11 

12import unittest 

13 

14import astro_metadata_translator 

15from astro_metadata_translator import ObservationInfo, makeObservationInfo 

16 

17 

18class BasicTestCase(unittest.TestCase): 

19 

20 def test_basic(self): 

21 version = astro_metadata_translator.__version__ 

22 self.assertIsNotNone(version) 

23 

24 def test_obsinfo(self): 

25 """Test construction of ObservationInfo without header.""" 

26 obsinfo = makeObservationInfo(boresight_airmass=1.5, tracking_radec=None) 

27 self.assertIsInstance(obsinfo, ObservationInfo) 

28 self.assertIsNone(obsinfo.tracking_radec) 

29 self.assertAlmostEqual(obsinfo.boresight_airmass, 1.5) 

30 self.assertIsNone(obsinfo.observation_id) 

31 self.assertEqual(obsinfo.cards_used, set()) 

32 self.assertEqual(obsinfo.stripped_header(), {}) 

33 

34 with self.assertRaises(TypeError): 

35 ObservationInfo.makeObservationInfo(boresight_airmass=1.5, observation_id=5) 

36 

37 with self.assertRaises(KeyError): 

38 obsinfo = ObservationInfo.makeObservationInfo(unrecognized=1.5, keys="unknown") 

39 

40 

41if __name__ == "__main__": 41 ↛ 42line 41 didn't jump to line 42, because the condition on line 41 was never true

42 unittest.main()