Coverage for C: \ Users \ peaco \ OneDrive \ Documents \ GitHub \ mt_metadata \ mt_metadata \ common \ range.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-10 00:11 -0800

1# ===================================================== 

2# Imports 

3# ===================================================== 

4from typing import Annotated 

5 

6from pydantic import AliasChoices, Field 

7 

8from mt_metadata.base import MetadataBase 

9 

10 

11# ===================================================== 

12class MinMaxRange(MetadataBase): 

13 """ 

14 Range of values. 

15 

16 Attributes 

17 ---------- 

18 minimum : float 

19 Minimum value of the range. 

20 maximum : float 

21 Maximum value of the range. 

22 """ 

23 

24 minimum: Annotated[ 

25 float, 

26 Field( 

27 default=0.0, 

28 description="Minimum value of the range.", 

29 validation_alias=AliasChoices("minimum", "min"), 

30 json_schema_extra={ 

31 "examples": "1.0", 

32 "type": "number", 

33 "units": None, 

34 "required": True, 

35 }, 

36 ), 

37 ] 

38 maximum: Annotated[ 

39 float, 

40 Field( 

41 default=0.0, 

42 description="Maximum value of the range.", 

43 validation_alias=AliasChoices("maximum", "max"), 

44 json_schema_extra={ 

45 "examples": "1.0", 

46 "type": "number", 

47 "units": None, 

48 "required": True, 

49 }, 

50 ), 

51 ] 

52 

53 

54class StartEndRange(MetadataBase): 

55 """ 

56 Range of values. 

57 

58 Attributes 

59 ---------- 

60 start : float 

61 starting value of the range. 

62 end : float 

63 Ending value of the range. 

64 """ 

65 

66 start: Annotated[ 

67 float, 

68 Field( 

69 default=0.0, 

70 description="Starting value.", 

71 validation_alias=AliasChoices("start", "beginning"), 

72 json_schema_extra={ 

73 "examples": "1.0", 

74 "type": "number", 

75 "units": None, 

76 "required": True, 

77 }, 

78 ), 

79 ] 

80 end: Annotated[ 

81 float, 

82 Field( 

83 default=0.0, 

84 description="Ending value of the range.", 

85 validation_alias=AliasChoices("end", "finish"), 

86 json_schema_extra={ 

87 "examples": "1.0", 

88 "type": "number", 

89 "units": None, 

90 "required": True, 

91 }, 

92 ), 

93 ]