Coverage for tests/test_matcher_probabilistic.py: 92%
33 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-22 17:35 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-22 17:35 +0000
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/>.
23import unittest
24import lsst.utils.tests
26from lsst.meas.astrom import MatchProbabilisticConfig
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 column_ref_order="x",
37 )
38 self.config_good = MatchProbabilisticConfig(**kwargs)
39 configs_bad = {}
40 kwargs["columns_target_meas"] = ["x"]
41 configs_bad["too_few_target_meas"] = MatchProbabilisticConfig(**kwargs)
42 kwargs["columns_target_meas"] = ["x", "y", "z"]
43 configs_bad["too_many_target_meas"] = MatchProbabilisticConfig(**kwargs)
44 kwargs["columns_target_meas"] = ["x", "y"]
45 kwargs["columns_target_err"] = ["xErr"]
46 configs_bad["too_few_target_err"] = MatchProbabilisticConfig(**kwargs)
47 kwargs["columns_target_err"] = ["xErr", "yErr", "zErr"]
48 configs_bad["too_many_target_err"] = MatchProbabilisticConfig(**kwargs)
49 self.configs_bad = configs_bad
51 def tearDown(self):
52 del self.config_good
53 del self.configs_bad
55 def test_MatchProbabilisticConfig(self):
56 for name, config in self.configs_bad.items():
57 with self.assertRaises(ValueError, msg=f"expected {name} failure"):
58 config.validate()
59 self.config_good.validate()
62class MemoryTester(lsst.utils.tests.MemoryTestCase):
63 pass
66def setup_module(module):
67 lsst.utils.tests.init()
70if __name__ == "__main__": 70 ↛ 71line 70 didn't jump to line 71 because the condition on line 70 was never true
71 lsst.utils.tests.init()
72 unittest.main()