Coverage for tests / test_healpixSkyMap.py: 34%

75 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-17 09:03 +0000

1import unittest 

2import lsst.geom as geom 

3import lsst.utils.tests 

4from helper import skyMapTestCase 

5 

6import hpgeom 

7 

8from lsst.skymap.healpixSkyMap import HealpixSkyMap 

9 

10 

11# TODO: Remove with DM-44799 

12class HealpixTestCase(skyMapTestCase.SkyMapTestCase): 

13 

14 def setUp(self): 

15 with self.assertWarns(FutureWarning): 

16 config = HealpixSkyMap.ConfigClass() 

17 nside = 2**config.log2NSide 

18 self.setAttributes( 

19 SkyMapClass=HealpixSkyMap, 

20 name="healpix", 

21 config=config, 

22 numTracts=hpgeom.nside_to_npixel(nside), 

23 numNeighbors=1, 

24 neighborAngularSeparation=hpgeom.max_pixel_radius(nside) * geom.degrees, 

25 ) 

26 

27 def getSkyMap(self, config=None): 

28 with self.assertWarns(FutureWarning): 

29 skymap = super().getSkyMap(config=config) 

30 return skymap 

31 

32 def getConfig(self): 

33 with self.assertWarns(FutureWarning): 

34 config = super().getConfig() 

35 return config 

36 

37 # def testRegistry(self): 

38 # with self.assertWarns(FutureWarning): 

39 # super().testRegistry() 

40 

41 def testBasicAttributes(self): 

42 with self.assertWarns(FutureWarning): 

43 super().testBasicAttributes() 

44 

45 def testPickle(self): 

46 with self.assertWarns(FutureWarning): 

47 super().testPickle() 

48 

49 def testTractSeparation(self): 

50 with self.assertWarns(FutureWarning): 

51 super().testTractSeparation() 

52 

53 def testFindPatchList(self): 

54 with self.assertWarns(FutureWarning): 

55 super().testFindPatchList() 

56 

57 def testFindTractPatchList(self): 

58 with self.assertWarns(FutureWarning): 

59 super().testFindTractPatchList() 

60 

61 def testTractContains(self): 

62 with self.assertWarns(FutureWarning): 

63 super().testTractContains() 

64 

65 def testTractInfoGetPolygon(self): 

66 with self.assertWarns(FutureWarning): 

67 super().testTractInfoGetPolygon() 

68 

69 def testPatchInfoGetPolygon(self): 

70 with self.assertWarns(FutureWarning): 

71 super().testPatchInfoGetPolygon() 

72 

73 def testTractInfoGetRegion(self): 

74 with self.assertWarns(FutureWarning): 

75 super().testTractInfoGetRegion() 

76 

77 def testDm14809(self): 

78 with self.assertWarns(FutureWarning): 

79 super().testDm14809() 

80 

81 def testNumbering(self): 

82 with self.assertWarns(FutureWarning): 

83 super().testNumbering() 

84 

85 def testSha1Compare(self): 

86 """Test that HealpixSkyMap's extra state is included in its hash.""" 

87 defaultSkyMap = self.getSkyMap() 

88 for log2NSide in (3, 4): 

89 config = self.getConfig() 

90 config.log2NSide = log2NSide 

91 skyMap = self.getSkyMap(config=config) 

92 self.assertNotEqual(skyMap, defaultSkyMap) 

93 for nest in (True,): 

94 config = self.getConfig() 

95 config.nest = nest 

96 skyMap = self.getSkyMap(config=config) 

97 self.assertNotEqual(skyMap, defaultSkyMap) 

98 

99 def tearDown(self): 

100 if hasattr(self, "config"): 

101 del self.config 

102 

103 

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

105 pass 

106 

107 

108def setup_module(module): 

109 lsst.utils.tests.init() 

110 

111 

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

113 lsst.utils.tests.init() 

114 unittest.main()