Coverage for python/lsst/pipe/tasks/configurableActions/tests.py: 83%

27 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2022-08-18 20:10 +0000

1# This file is part of pipe_tasks. 

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/>. 

21from __future__ import annotations 

22 

23__all__ = ( 

24 "ActionTest1", 

25 "ActionTest2", 

26 "ActionTest3", 

27 "TestConfig", 

28) 

29 

30from lsst.pex.config import Config, Field 

31from ._configurableAction import ConfigurableAction 

32from ._configurableActionStructField import ConfigurableActionStructField 

33from ._configurableActionField import ConfigurableActionField 

34 

35 

36class ActionTest1(ConfigurableAction): 

37 var = Field(doc="test field", dtype=int, default=0) 

38 

39 def __call__(self): 

40 return self.var 

41 

42 def validate(self): 

43 assert(self.var is not None) 

44 

45 

46class ActionTest2(ConfigurableAction): 

47 var = Field(doc="test field", dtype=int, default=1) 

48 

49 def __call__(self): 

50 return self.var 

51 

52 def validate(self): 

53 assert(self.var is not None) 

54 

55 

56class ActionTest3(ConfigurableAction): 

57 var = Field(doc="test field", dtype=int, default=3) 

58 

59 def __call__(self): 

60 return self.var 

61 

62 def validate(self): 

63 assert(self.var is not None) 

64 

65 

66class TestConfig(Config): 

67 actions = ConfigurableActionStructField(doc="Actions to be tested", default=None) 

68 singleAction = ConfigurableActionField(doc="A configurable action", default=None)