Coverage for tests/test_analysis_tools.py: 88%

24 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-09-19 03:32 -0700

1# This file is part of meas_extensions_multiprofit. 

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 

22import pytest 

23 

24# analysis_tools is not and should not be a dependency of this package, so 

25# only run these tests if it is set up. 

26try: 

27 from lsst.meas.extensions.multiprofit.analysis_tools import MultiProFitSersicSizeMagnitudePlot 

28 

29 has_analysis_tools = True 

30except ImportError: 

31 has_analysis_tools = False 

32 

33if has_analysis_tools: 33 ↛ exitline 33 didn't exit the module because the condition on line 33 was always true

34 

35 @pytest.fixture(scope="module") 

36 def kwargs_plot(): 

37 """Return sensible kwargs for size-magnitude plots.""" 

38 kwargs = dict( 

39 xLims=(18, 25), 

40 yLims=(-3, 4), 

41 ) 

42 return kwargs 

43 

44 @pytest.fixture(scope="module") 

45 def tool_sersic(kwargs_plot): 

46 """Return a finalized Sersic size-magnitude plot action.""" 

47 atool = MultiProFitSersicSizeMagnitudePlot() 

48 atool.finalize() 

49 return atool 

50 

51 @pytest.fixture(scope="module") 

52 def data_sersic(tool_sersic): 

53 """Return the schema for the Sersic size-magnitude plot action.""" 

54 schema = tool_sersic.getInputSchema() 

55 data = {key: [] for key in schema} 

56 return data 

57 

58 def test_psf_fits(tool_sersic, data_sersic): 

59 """Test that the tool and its schema are useable.""" 

60 assert tool_sersic is not None 

61 assert len(data_sersic) > 0