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

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

# This file is part of astro_metadata_translator. 

# 

# Developed for the LSST Data Management System. 

# This product includes software developed by the LSST Project 

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

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

# for details of code ownership. 

# 

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

# license that can be found in the LICENSE file. 

 

import unittest 

 

import astro_metadata_translator 

from astro_metadata_translator import ObservationInfo, makeObservationInfo 

 

 

class BasicTestCase(unittest.TestCase): 

 

def test_basic(self): 

version = astro_metadata_translator.__version__ 

self.assertIsNotNone(version) 

 

def test_obsinfo(self): 

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

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

self.assertIsInstance(obsinfo, ObservationInfo) 

self.assertIsNone(obsinfo.tracking_radec) 

self.assertAlmostEqual(obsinfo.boresight_airmass, 1.5) 

self.assertIsNone(obsinfo.observation_id) 

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

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

 

with self.assertRaises(TypeError): 

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

 

with self.assertRaises(KeyError): 

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

 

 

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

unittest.main()