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#!/usr/bin/env python 

2 

3# 

4# LSST Data Management System 

5# Copyright 2008, 2009, 2010 LSST Corporation. 

6# 

7# This product includes software developed by the 

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

9# 

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

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

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

13# (at your option) any later version. 

14# 

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

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

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

18# GNU General Public License for more details. 

19# 

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

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

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

23# 

24 

25""" 

26Comprehensive tests reading and retrieving data of all types 

27""" 

28 

29import unittest 

30import lsst.utils.tests 

31 

32from lsst.pex.policy import Policy, PolicyStringDestination, PAFWriter 

33 

34 

35class PolicyOutStringTestCase(unittest.TestCase): 

36 

37 def setUp(self): 

38 self.policy = Policy() 

39 self.policy.set("answer", 42) 

40 self.policy.set("name", "ray") 

41 

42 def tearDown(self): 

43 del self.policy 

44 

45 def testDest(self): 

46 dest = PolicyStringDestination("#<?cfg paf policy ?>") 

47 self.assertEqual(dest.getData(), "#<?cfg paf policy ?>") 

48 

49 def testWrite(self): 

50 writer = PAFWriter() 

51 writer.write(self.policy, True) 

52 out = writer.toString() 

53 self.assertTrue(out.startswith("#<?cfg paf policy ?>")) 

54 

55 

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

57 pass 

58 

59 

60__all__ = "PolicyOutStringTestCase".split() 

61 

62 

63def setup_module(module): 

64 lsst.utils.tests.init() 

65 

66 

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

68 lsst.utils.tests.init() 

69 unittest.main()