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 2018 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# 

22import unittest 

23 

24import lsst.utils.tests 

25import lsst.geom 

26import lsst.afw.geom as afwGeom 

27 

28 

29class GeomAliasesTestCase(lsst.utils.tests.TestCase): 

30 

31 def testAngleAliases(self): 

32 with self.assertWarns(FutureWarning): 

33 self.assertEqual(afwGeom.Angle(1), lsst.geom.Angle(1)) 

34 

35 self.assertIs(afwGeom.radians, lsst.geom.radians) 

36 self.assertIs(afwGeom.degrees, lsst.geom.degrees) 

37 self.assertIs(afwGeom.hours, lsst.geom.hours) 

38 self.assertIs(afwGeom.arcminutes, lsst.geom.arcminutes) 

39 self.assertIs(afwGeom.arcseconds, lsst.geom.arcseconds) 

40 

41 self.assertIs(afwGeom.PI, lsst.geom.PI) 

42 self.assertIs(afwGeom.TWOPI, lsst.geom.TWOPI) 

43 self.assertIs(afwGeom.HALFPI, lsst.geom.HALFPI) 

44 self.assertIs(afwGeom.ONE_OVER_PI, lsst.geom.ONE_OVER_PI) 

45 self.assertIs(afwGeom.SQRTPI, lsst.geom.SQRTPI) 

46 self.assertIs(afwGeom.INVSQRTPI, lsst.geom.INVSQRTPI) 

47 self.assertIs(afwGeom.ROOT2, lsst.geom.ROOT2) 

48 

49 with self.assertWarns(FutureWarning): 

50 self.assertEqual(afwGeom.degToRad(1), lsst.geom.degToRad(1)) 

51 with self.assertWarns(FutureWarning): 

52 self.assertEqual(afwGeom.radToDeg(1), lsst.geom.radToDeg(1)) 

53 with self.assertWarns(FutureWarning): 

54 self.assertEqual(afwGeom.radToArcsec(1), lsst.geom.radToArcsec(1)) 

55 with self.assertWarns(FutureWarning): 

56 self.assertEqual(afwGeom.radToMas(1), lsst.geom.radToMas(1)) 

57 with self.assertWarns(FutureWarning): 

58 self.assertEqual(afwGeom.arcsecToRad(1), lsst.geom.arcsecToRad(1)) 

59 with self.assertWarns(FutureWarning): 

60 self.assertEqual(afwGeom.masToRad(1), lsst.geom.masToRad(1)) 

61 

62 def testCoordAliases(self): 

63 with self.assertWarns(FutureWarning): 

64 self.assertIsInstance(afwGeom.ExtentI(), lsst.geom.ExtentI) 

65 with self.assertWarns(FutureWarning): 

66 self.assertIsInstance(afwGeom.Extent2I(), lsst.geom.Extent2I) 

67 with self.assertWarns(FutureWarning): 

68 self.assertIsInstance(afwGeom.Extent3I(), lsst.geom.Extent3I) 

69 

70 with self.assertWarns(FutureWarning): 

71 self.assertIsInstance(afwGeom.ExtentD(), lsst.geom.ExtentD) 

72 with self.assertWarns(FutureWarning): 

73 self.assertIsInstance(afwGeom.Extent2D(), lsst.geom.Extent2D) 

74 with self.assertWarns(FutureWarning): 

75 self.assertIsInstance(afwGeom.Extent3D(), lsst.geom.Extent3D) 

76 

77 with self.assertWarns(FutureWarning): 

78 self.assertIsInstance(afwGeom.PointI(), lsst.geom.PointI) 

79 with self.assertWarns(FutureWarning): 

80 self.assertIsInstance(afwGeom.Point2I(), lsst.geom.Point2I) 

81 with self.assertWarns(FutureWarning): 

82 self.assertIsInstance(afwGeom.Point3I(), lsst.geom.Point3I) 

83 

84 with self.assertWarns(FutureWarning): 

85 self.assertIsInstance(afwGeom.PointD(), lsst.geom.PointD) 

86 with self.assertWarns(FutureWarning): 

87 self.assertIsInstance(afwGeom.Point2D(), lsst.geom.Point2D) 

88 with self.assertWarns(FutureWarning): 

89 self.assertIsInstance(afwGeom.Point3D(), lsst.geom.Point3D) 

90 

91 def testOtherAliases(self): 

92 with self.assertWarns(FutureWarning): 

93 self.assertIsInstance(afwGeom.BoxI(), lsst.geom.BoxI) 

94 with self.assertWarns(FutureWarning): 

95 self.assertIsInstance(afwGeom.BoxI(), lsst.geom.Box2I) 

96 with self.assertWarns(FutureWarning): 

97 self.assertIsInstance(afwGeom.BoxD(), lsst.geom.BoxD) 

98 with self.assertWarns(FutureWarning): 

99 self.assertIsInstance(afwGeom.BoxD(), lsst.geom.Box2D) 

100 

101 with self.assertWarns(FutureWarning): 

102 self.assertIsInstance(afwGeom.SpherePoint(), lsst.geom.SpherePoint) 

103 

104 with self.assertWarns(FutureWarning): 

105 self.assertIsInstance(afwGeom.AffineTransform(), lsst.geom.AffineTransform) 

106 with self.assertWarns(FutureWarning): 

107 self.assertIsInstance(afwGeom.LinearTransform(), lsst.geom.LinearTransform) 

108 

109 

110class MemoryTester(lsst.utils.tests.MemoryTestCase): 

111 pass 

112 

113 

114def setup_module(module): 

115 lsst.utils.tests.init() 

116 

117 

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

119 lsst.utils.tests.init() 

120 unittest.main()