Coverage for tests/test_photodiode.py: 56%

Shortcuts 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

26 statements  

1# 

2# LSST Data Management System 

3# 

4# Copyright 2008-2017 AURA/LSST. 

5# 

6# This product includes software developed by the 

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

8# 

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

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

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

12# (at your option) any later version. 

13# 

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

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

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

17# GNU General Public License for more details. 

18# 

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

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

21# see <https://www.lsstcorp.org/LegalNotices/>. 

22# 

23"""Test cases for lsst.cp.pipe.FindDefectsTask.""" 

24 

25import unittest 

26import tempfile 

27 

28import lsst.utils 

29import lsst.utils.tests 

30 

31from lsst.cp.pipe.ptc.photodiode import PhotodiodeData 

32 

33 

34class PhotodiodeDataTestCase(lsst.utils.tests.TestCase): 

35 """A test case dealing with photodiode data.""" 

36 

37 def test_getBOTphotodiodeData(self): 

38 # Need a fake dataRef to even check that this raises or returns None 

39 pass 

40 

41 def test_photodiodeClass(self): 

42 with tempfile.NamedTemporaryFile(mode='w+t') as f: 

43 # nonuniform time steps, negative currents 

44 f.write('0. -1E-10\n') 

45 f.write('1. 2E-10\n') 

46 f.write('4. 3E-10\n') 

47 f.write('6. 2E-10\n') 

48 

49 f.file.flush() 

50 

51 diodeData = PhotodiodeData(f.name) 

52 charge = diodeData.getCharge() 

53 self.assertEqual(charge, 1.3e-9) 

54 

55 

56class TestMemory(lsst.utils.tests.MemoryTestCase): 

57 pass 

58 

59 

60def setup_module(module): 

61 lsst.utils.tests.init() 

62 

63 

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

65 lsst.utils.tests.init() 

66 unittest.main()