Coverage for tests/test_sdss.py: 55%

14 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2022-09-07 09:25 +0000

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 os.path 

13import unittest 

14 

15import astropy.units as u 

16 

17from astro_metadata_translator.tests import MetadataAssertHelper 

18 

19TESTDIR = os.path.abspath(os.path.dirname(__file__)) 

20 

21 

22class SdssTestCase(unittest.TestCase, MetadataAssertHelper): 

23 datadir = os.path.join(TESTDIR, "data") 

24 

25 def test_sdss_translator(self): 

26 test_data = ( 

27 ( 

28 "fitsheader-sdss-fpC-006377-g4-0399.yaml", 

29 dict( 

30 telescope="SDSS 2.5m", 

31 instrument="Imager on SDSS 2.5m", 

32 boresight_rotation_coord="sky", 

33 dark_time=0.0 * u.s, 

34 detector_exposure_id=6377140399, 

35 detector_name="54", 

36 detector_unique_name="g4", 

37 detector_group="4", 

38 detector_num=15, 

39 detector_serial="UNKNOWN", 

40 exposure_id=6377, 

41 exposure_group="6377", 

42 exposure_time=53.907456 * u.s, 

43 group_counter_end=0, 

44 group_counter_start=0, 

45 has_simulated_content=False, 

46 object="82 S", 

47 observation_counter=0, 

48 observation_id="6377 4 g 407", 

49 observation_type="science", 

50 observation_reason="science", 

51 observing_day=20060920, 

52 physical_filter="g", 

53 pressure=None, 

54 relative_humidity=None, 

55 science_program="82 S", 

56 temperature=None, 

57 visit_id=6377, 

58 wcs_params=dict(max_sep=10.0), 

59 ), 

60 ), 

61 ) 

62 for file, expected in test_data: 

63 with self.subTest(f"Testing {file}"): 

64 self.assertObservationInfoFromYaml(file, dir=self.datadir, **expected) 

65 

66 

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

68 unittest.main()