Coverage for tests/test_matcher_probabilistic.py: 31%

33 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-05-04 02:55 -0700

1# This file is part of meas_astrom. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://www.lsst.org). 

6# See the COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

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 GNU General Public License 

20# along with this program. If not, see <https://www.gnu.org/licenses/>. 

21 

22 

23import unittest 

24import lsst.utils.tests 

25 

26from lsst.meas.astrom import MatchProbabilisticConfig 

27 

28 

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

30 """MatchProbabilisticConfig test case.""" 

31 def setUp(self): 

32 kwargs = dict( 

33 columns_ref_meas=["x", "y"], 

34 columns_target_meas=["x", "y"], 

35 columns_target_err=["xErr", "yErr"], 

36 ) 

37 configs_bad = {"too_few_finite": MatchProbabilisticConfig(**kwargs)} 

38 self.config_good = MatchProbabilisticConfig(match_n_finite_min=2, **kwargs) 

39 kwargs["columns_target_meas"] = ["x"] 

40 configs_bad["too_few_target_meas"] = MatchProbabilisticConfig(**kwargs) 

41 kwargs["columns_target_meas"] = ["x", "y", "z"] 

42 configs_bad["too_many_target_meas"] = MatchProbabilisticConfig(**kwargs) 

43 kwargs["columns_target_meas"] = ["x", "y"] 

44 kwargs["columns_target_err"] = ["xErr"] 

45 configs_bad["too_few_target_err"] = MatchProbabilisticConfig(**kwargs) 

46 kwargs["columns_target_err"] = ["xErr", "yErr", "zErr"] 

47 configs_bad["too_many_target_err"] = MatchProbabilisticConfig(**kwargs) 

48 self.configs_bad = configs_bad 

49 

50 def tearDown(self): 

51 del self.config_good 

52 del self.configs_bad 

53 

54 def test_MatchProbabilisticTask(self): 

55 for name, config in self.configs_bad.items(): 

56 with self.assertRaises(ValueError, msg=f"expected {name} failure"): 

57 config.validate() 

58 self.config_good.validate() 

59 

60 

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

62 pass 

63 

64 

65def setup_module(module): 

66 lsst.utils.tests.init() 

67 

68 

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

70 lsst.utils.tests.init() 

71 unittest.main()