Coverage for metadetect / lsst / tests / test_lsst_configs.py: 19%
36 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-04 02:02 -0800
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-04 02:02 -0800
1"""
2test configs
4note we allow the get_all_metacal to do its own verifiction
5of the metacal sub config
6"""
7import pytest
9from metadetect.lsst.configs import get_config
10from metadetect.lsst.defaults import DEFAULT_STAMP_SIZE
13def test_configs_smoke():
14 config = get_config()
16 # make sure the default is verified
17 get_config(config)
19 with pytest.raises(ValueError):
20 get_config({'blah': 3})
23@pytest.mark.parametrize('stamp_size', [None, 39])
24def test_stamp_size_config(stamp_size):
25 inconfig = {}
27 if stamp_size is not None:
28 inconfig['stamp_size'] = stamp_size
30 config = get_config(inconfig)
31 if stamp_size is None:
32 assert config['stamp_size'] == DEFAULT_STAMP_SIZE
33 else:
34 assert config['stamp_size'] == stamp_size
37def test_pgauss_config():
38 # make sure the default is verified
39 get_config()
40 inconfig = {}
41 get_config(inconfig)
43 fwhm = 1.2
44 pgauss_conf = {'fwhm': fwhm}
46 inconfig = {'pgauss': pgauss_conf}
47 config = get_config(inconfig)
48 assert config['pgauss']['fwhm'] == fwhm
50 for key in pgauss_conf:
51 assert config['pgauss'][key] == pgauss_conf[key]
53 with pytest.raises(ValueError):
54 get_config({'pgauss': {'blah': 3}})
57def test_detect_config():
58 in_config = {'detect': {'thresh': 5}}
59 config = get_config()
60 assert config['detect']['thresh'] == in_config['detect']['thresh']
62 with pytest.raises(ValueError):
63 get_config({'detect': {'blah': 5}})