Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/bliss/test_object.py: 0%

42 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-14 02:13 +0000

1from bliss.config.beacon_object import BeaconObject 

2 

3 

4class TestObject(BeaconObject): 

5 def __init__(self, name, config_tree): 

6 self._config = config_tree.get("config") 

7 self._name = name 

8 

9 super().__init__(config_tree) 

10 

11 self._string = "abcd" 

12 self._number = 123.456 

13 self._option = "one" 

14 self._options = ["one", "two", "three"] 

15 self._read_only = 42 

16 

17 def __info__(self): 

18 info_str = f"{self._name}:\n" 

19 for k in ["string", "number", "option", "read_only"]: 

20 info_str += f" {k}: {getattr(self, '_' + k)}\n" 

21 return info_str 

22 

23 @property 

24 def state(self): 

25 return 1 

26 

27 @property 

28 def read_only(self): 

29 return self._read_only 

30 

31 @BeaconObject.property() 

32 def string(self): 

33 return self._string 

34 

35 @string.setter 

36 def string(self, value): 

37 self._string = value 

38 

39 @BeaconObject.property() 

40 def number(self): 

41 return self._number 

42 

43 @number.setter 

44 def number(self, value): 

45 self._number = value 

46 

47 @BeaconObject.property() 

48 def option(self): 

49 return self._option 

50 

51 @option.setter 

52 def option(self, value): 

53 self._option = value 

54 

55 def options(self): 

56 return self._options