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# LSST Data Management System 

3# Copyright 2012-2016 LSST Corporation. 

4# 

5# This product includes software developed by the 

6# LSST Project (http://www.lsst.org/). 

7# 

8# This program is free software: you can redistribute it and/or modify 

9# it under the terms of the GNU General Public License as published by 

10# the Free Software Foundation, either version 3 of the License, or 

11# (at your option) any later version. 

12# 

13# This program is distributed in the hope that it will be useful, 

14# but WITHOUT ANY WARRANTY; without even the implied warranty of 

15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

16# GNU General Public License for more details. 

17# 

18# You should have received a copy of the LSST License Statement and 

19# the GNU General Public License along with this program. If not, 

20# see <http://www.lsstcorp.org/LegalNotices/>. 

21# 

22 

23 

24import os 

25import unittest 

26 

27import lsst.utils 

28 

29from lsst.validate.drp import util 

30 

31 

32class LoadDataTestCase(unittest.TestCase): 

33 """Testing loading of configuration files and repo.""" 

34 

35 def setUp(self): 

36 validateDrpDir = lsst.utils.getPackageDir('validate_drp') 

37 testDataDir = os.path.join(validateDrpDir, 'tests') 

38 self.configFile = os.path.join(testDataDir, 'runCfht.yaml') 

39 self.configFileNoDataIds = os.path.join(testDataDir, 'runCfhtParametersOnly.yaml') 

40 

41 def tearDown(self): 

42 pass 

43 

44 def testLoadingOfConfigFileParameters(self): 

45 pbStruct = util.loadDataIdsAndParameters(self.configFile) 

46 self.assertAlmostEqual(pbStruct.brightSnrMin, 50) 

47 

48 def testLoadingOfConfigFileDataIds(self): 

49 pbStruct = util.loadDataIdsAndParameters(self.configFile) 

50 # Tests of the dict entries require constructing and comparing sets 

51 self.assertEqual(set(['r']), set([d['filter'] for d in pbStruct.dataIds])) 

52 self.assertEqual(set([849375, 850587]), 

53 set([d['visit'] for d in pbStruct.dataIds])) 

54 

55 def testLoadingEmptyDataIds(self): 

56 pbStruct = util.loadDataIdsAndParameters(self.configFileNoDataIds) 

57 # Tests of the dict entries require constructing and comparing sets 

58 self.assertFalse(pbStruct.dataIds) 

59 

60 

61def setup_module(module): 

62 lsst.utils.tests.init() 

63 

64 

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

66 lsst.utils.tests.init() 

67 unittest.main()