cactus-test-definitions 1.2.0__py3-none-any.whl → 1.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cactus-test-definitions might be problematic. Click here for more details.

@@ -18,7 +18,7 @@ from cactus_test_definitions.variable_expressions import (
18
18
  try_extract_variable_expression,
19
19
  )
20
20
 
21
- __version__ = "1.2.0"
21
+ __version__ = "1.3.0"
22
22
 
23
23
  __all__ = [
24
24
  "TestProcedureDefinitionError",
@@ -33,6 +33,16 @@ class Check:
33
33
  self.parameters[k] = parse_variable_expression_body(variable_expr, k)
34
34
 
35
35
 
36
+ def factory_readings_schema() -> dict[str, Any]:
37
+ """Factory function for common schema shared across reading checks."""
38
+ return {
39
+ "minimum_count": ParameterSchema(False, ParameterType.Integer),
40
+ "minimum_level": ParameterSchema(False, ParameterType.Float),
41
+ "maximum_level": ParameterSchema(False, ParameterType.Float),
42
+ "window_seconds": ParameterSchema(False, ParameterType.UnsignedInteger),
43
+ }
44
+
45
+
36
46
  # The parameter schema for each action, keyed by the action name
37
47
  CHECK_PARAMETER_SCHEMA: dict[str, dict[str, ParameterSchema]] = {
38
48
  "all-steps-complete": {"ignored_steps": ParameterSchema(False, ParameterType.ListString)},
@@ -88,12 +98,12 @@ CHECK_PARAMETER_SCHEMA: dict[str, dict[str, ParameterSchema]] = {
88
98
  "operationalModeStatus": ParameterSchema(False, ParameterType.Integer),
89
99
  "alarmStatus": ParameterSchema(False, ParameterType.Integer),
90
100
  },
91
- "readings-voltage": {"minimum_count": ParameterSchema(True, ParameterType.Integer)},
92
- "readings-site-active-power": {"minimum_count": ParameterSchema(True, ParameterType.Integer)},
93
- "readings-site-reactive-power": {"minimum_count": ParameterSchema(True, ParameterType.Integer)},
94
- "readings-der-active-power": {"minimum_count": ParameterSchema(True, ParameterType.Integer)},
95
- "readings-der-reactive-power": {"minimum_count": ParameterSchema(True, ParameterType.Integer)},
96
- "readings-der-stored-energy": {"minimum_count": ParameterSchema(True, ParameterType.Integer)}, # Storage extension
101
+ "readings-voltage": factory_readings_schema(),
102
+ "readings-site-active-power": factory_readings_schema(),
103
+ "readings-site-reactive-power": factory_readings_schema(),
104
+ "readings-der-active-power": factory_readings_schema(),
105
+ "readings-der-reactive-power": factory_readings_schema(),
106
+ "readings-der-stored-energy": factory_readings_schema(),
97
107
  "subscription-contents": {"subscribed_resource": ParameterSchema(True, ParameterType.String)},
98
108
  "response-contents": {
99
109
  "latest": ParameterSchema(False, ParameterType.Boolean),
@@ -30,6 +30,7 @@ class ParameterType(IntEnum):
30
30
  ListCSIPAusReadingType = auto() # List where each member is a cactus_test_definitions.csipaus.CSIPAusReadingType
31
31
  CSIPAusReadingLocation = auto() # Member of cactus_test_definitions.csipaus.CSIPAusReadingLocation
32
32
  ReadingTypeValues = auto() # A dict of type dict[CSIPAusReadingType, list[float]], each list has the same length
33
+ UnsignedInteger = auto()
33
34
 
34
35
 
35
36
  @dataclass(frozen=True)
@@ -61,6 +62,9 @@ def is_valid_parameter_type(expected_type: ParameterType, value: Any) -> bool:
61
62
  return int(value) == value
62
63
  except Exception:
63
64
  return False
65
+ case ParameterType.UnsignedInteger:
66
+ # Integer that is greater than or equal to 0
67
+ return is_valid_parameter_type(ParameterType.Integer, value) and value >= 0
64
68
  case ParameterType.Float:
65
69
  return isinstance(value, float) or isinstance(value, Decimal) or isinstance(value, int)
66
70
  case ParameterType.Boolean:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cactus-test-definitions
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: CSIP-AUS Client Test Harness Test Definitions
5
5
  Author-email: Mike Turner <mike.turner@anu.edu.au>, Josh Vote <joshua.vote@anu.edu.au>
6
6
  Maintainer-email: Mike Turner <mike.turner@anu.edu.au>, Josh Vote <joshua.vote@anu.edu.au>
@@ -203,11 +203,11 @@ checks:
203
203
  | `der-settings-contents` | `setGradW: int/None` `doeModesEnabled_set: hex/none` `doeModesEnabled_unset: hex/none` `doeModesEnabled: bool/none` `modesEnabled_set: hex/none` `modesEnabled_unset: hex/none` `setMaxVA: bool/none` `setMaxVar: bool/none` `setMaxW: bool/none` `setMaxChargeRateW: bool/none` `setMaxDischargeRateW: bool/none` `setMaxWh: bool/none` `setMinWh: bool/none` `vppModesEnabled_set: hexbinary/none` `vppModesEnabled_unset: hexbinary/none` `setMaxVarNeg: bool/none` `setMinPFOverExcited: bool/none` `setMinPFUnderExcited: bool/none` | True if a `DERSettings` has been set for the `EndDevice` under test (and if certain elements have been set to certain values) |
204
204
  | `der-capability-contents` | `doeModesSupported_set: hex/none` `doeModesSupported_unset: hex/none` `doeModesSupported: bool/none` `modesSupported_set: hex/none` `modesSupported_unset: hex/none` `rtgMaxVA: bool/none` `rtgMaxVar: bool/none` `rtgMaxW: bool/none` `rtgMaxChargeRateW: bool/none` `rtgMaxDischargeRateW: bool/none` `rtgMaxWh: bool/none` `vppModesSupported_set: hexbinary/none` `vppModesSupported_unset: hexbinary/none` `rtgMaxVarNeg: bool/none` `rtgMinPFOverExcited: bool/none` `rtgMinPFUnderExcited: bool/none` | True if a `DERCapability` has been set for the `EndDevice` under test (and if certain elements have been set to certain values) |
205
205
  | `der-status-contents` | `genConnectStatus: int/None` `operationalModeStatus: int/None` `alarmStatus: int/None` | True if a `DERStatus` has been set for the `EndDevice` under test (and if certain elements have been set to certain values) |
206
- | `readings-site-active-power` | `minimum_count: int` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide active power with `minimum_count` entries |
207
- | `readings-site-reactive-power` | `minimum_count: int` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide reactive power with `minimum_count` entries |
208
- | `readings-voltage` | `minimum_count: int` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide voltage OR DER voltage with `minimum_count` entries (at least one is required) |
209
- | `readings-der-active-power` | `minimum_count: int` | True if any MirrorUsagePoint has a MirrorMeterReading for DER active power with `minimum_count` entries |
210
- | `readings-der-reactive-power` | `minimum_count: int` | True if any MirrorUsagePoint has a MirrorMeterReading for DER reactive power with `minimum_count` entries |
206
+ | `readings-site-active-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide active power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
207
+ | `readings-site-reactive-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide reactive power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
208
+ | `readings-voltage` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide voltage OR DER voltage with `minimum_count` entries (at least one is required) |
209
+ | `readings-der-active-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for DER active power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
210
+ | `readings-der-reactive-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for DER reactive power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
211
211
  | `response-contents` | `latest: bool/None` `status: int/None` `all: bool/None` | True if at least one received Response matches the filter. `latest` will only consider the most recent received Response. `all` will look for a nominated status match for every `DERControl` |
212
212
  | `subscription-contents` | `subscribed_resource: str` | True if a subscription to `subscribed_resource` has been created |
213
213
 
@@ -215,7 +215,7 @@ The following are csipaus.org/ns/v1.3-beta/storage extension specific checks imp
215
215
 
216
216
  | **name** | **params** | **description** |
217
217
  | -------- | ---------- | --------------- |
218
- | `readings-der-stored-energy` | `minimum_count: int` | True if any MirrorUsagePoint has a MirrorMeterReading for DER stored energy with `minimum_count` entries |
218
+ | `readings-der-stored-energy` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for DER stored energy with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
219
219
  <br>
220
220
 
221
221
  #### Hexbinary Parameters for Bitwise Operations
@@ -1,7 +1,7 @@
1
- cactus_test_definitions/__init__.py,sha256=PUvdJH3ZVqVLdZL3Xyal76YRHmEg8b4HnVdTaQxChFw,987
1
+ cactus_test_definitions/__init__.py,sha256=POQ9DrRzKNT3K4_tjdoTC1vmx7O1bIhR4jlkAEqYOpo,987
2
2
  cactus_test_definitions/csipaus.py,sha256=HhBM6scS-Hlz8hFoGct7D2cJOK8NCN6f3CDP72gv7Dk,2864
3
3
  cactus_test_definitions/errors.py,sha256=_ZKl42SaEF5c2s9YySJUjGqVCBXSQYOLxpHQhSbNFug,458
4
- cactus_test_definitions/parameters.py,sha256=y2pCrE6MADXA53ZVZeNWj0_yWHcKOZ2imzjh_pZDorQ,6509
4
+ cactus_test_definitions/parameters.py,sha256=FcWvB2UX2MVLYUY8mzGzbFfro3jyLQuoHXzrfoblnic,6727
5
5
  cactus_test_definitions/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  cactus_test_definitions/schema.py,sha256=XYMlr2l_pfbyuwXLO88YryjObvxDVEV5IZ2hsThdy2k,736
7
7
  cactus_test_definitions/variable_expressions.py,sha256=6oVRj-6lXVKt6zIpSmXpzD2A8ayOWZ2eEpO5_uR6OdE,16741
@@ -19,7 +19,7 @@ cactus_test_definitions/__pycache__/variable_expressions.cpython-312.pyc,sha256=
19
19
  cactus_test_definitions/__pycache__/version.cpython-312.pyc,sha256=MYqjwvU2QmzT5lHqXLMdvVg1hQ9eN0gLQnluRgpLn0M,624
20
20
  cactus_test_definitions/client/__init__.py,sha256=M5rZLtoAKOgtzgC51KlB_iVhS3mo1ujMjJg5cnD4Z3w,692
21
21
  cactus_test_definitions/client/actions.py,sha256=tJNNVmK_itcXPgHxewBZvUsw3u0WK67S5zliULGForI,4924
22
- cactus_test_definitions/client/checks.py,sha256=8MEfG5YDVPFXrIySf_e2ePnLUHqdd3Odq7LmIIFGeDI,7415
22
+ cactus_test_definitions/client/checks.py,sha256=yrRiKxCVDZeZi4MkhHOrhqff-YjlAwCA7d7qqM04Dno,7604
23
23
  cactus_test_definitions/client/events.py,sha256=Skt7rovadrpVqY7nUpxP0MGG_-1wWlD28JPKhZX-z8E,3098
24
24
  cactus_test_definitions/client/test_procedures.py,sha256=7ZUlBXf6r6DHVakJpLseYaG_mpbjyqFFE0SwYOcU0UU,11059
25
25
  cactus_test_definitions/client/__pycache__/__init__.cpython-312.pyc,sha256=nk72E-Cj_QWolW48s8S_mHerqAhMnb4f8CT0_QSvUqA,785
@@ -115,7 +115,7 @@ cactus_test_definitions/server/procedures/S-OPT-02.yaml,sha256=jMoMRo_vgfaB9yoY9
115
115
  cactus_test_definitions/server/procedures/S-OPT-03.yaml,sha256=tOzDTOE9D-CWT61RuWRTDGcpt7W57NcH9_eZvQyLhFs,980
116
116
  cactus_test_definitions/server/procedures/S-OPT-04.yaml,sha256=o33HNLTzxQm__KbFW1x2ce04uW-xx6Li0aijJI_XbYQ,667
117
117
  cactus_test_definitions/server/procedures/test-procedures.yaml,sha256=3GqHgROh3YvenXB3RH9lg05809IqAtp_uohT_hUdyIE,395
118
- cactus_test_definitions-1.2.0.dist-info/licenses/LICENSE.txt,sha256=xCq-ofiZHRqQJHkhY1M-eXahPozfXmo9qvez6BiCOdk,1074
118
+ cactus_test_definitions-1.3.0.dist-info/licenses/LICENSE.txt,sha256=xCq-ofiZHRqQJHkhY1M-eXahPozfXmo9qvez6BiCOdk,1074
119
119
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
120
  tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
121
121
  tests/unit/test_csipaus.py,sha256=edFnWDlHgMuW7CK9l8z-FHA1GcIACVJ1RPERiFuWfcY,1959
@@ -123,13 +123,13 @@ tests/unit/test_parameters.py,sha256=FqkJtC2Tct9hbuznzzsNyomvmZ24Q3RS2B_tfK0-T5M
123
123
  tests/unit/test_variable_expressions.py,sha256=HTeEcLiJPmMREJs4mOfR0Q48l8E-XYyQgISn5XLW2BU,15969
124
124
  tests/unit/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
125
  tests/unit/client/test_actions.py,sha256=pIVprTLPpD4mGkmORArIEKuoFShzWleakqEZHDGV4rQ,3172
126
- tests/unit/client/test_checks.py,sha256=PPQDnoZU02-nXcWaXBfm09hG9DUx7O6ZCPVbshazy78,2419
126
+ tests/unit/client/test_checks.py,sha256=Al91dwToyn_1LGjb2dVLNjHAOcGfXwK_GTr0dVOzKsI,3417
127
127
  tests/unit/client/test_config.py,sha256=0Jdgd6DsZuq35OQDUP-l9H9QlQuNaaqDXWV_r7ssLto,2454
128
128
  tests/unit/client/test_events.py,sha256=bXDW0Ykx9hqh8MLv1b_9a942LahlhE3L2pu7NyGsdRo,1550
129
129
  tests/unit/client/test_test_procedures.py,sha256=GKOQo007C4o4DbsCL4aJfpPqz108ueQ-zJUpwHu56Uw,6950
130
130
  tests/unit/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
131
131
  tests/unit/server/test_test_procedures.py,sha256=5yC3Npq6PrDqj4A3URcFd5-0cXmLooxWt51OXJ4Kd0U,3976
132
- cactus_test_definitions-1.2.0.dist-info/METADATA,sha256=9JXbXfXYhxZnrgqJicrBOjRQht7ZB2QxoqPz1hd5UO4,21248
133
- cactus_test_definitions-1.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
134
- cactus_test_definitions-1.2.0.dist-info/top_level.txt,sha256=4tQTXLPjTzH6OYZqOj40IX8XgosTUTUEJTESjtj0KfI,30
135
- cactus_test_definitions-1.2.0.dist-info/RECORD,,
132
+ cactus_test_definitions-1.3.0.dist-info/METADATA,sha256=uM1ZFnnEHqnZp2X4UmB4vj6jdqemzFsiMqcBnn_xBF8,22367
133
+ cactus_test_definitions-1.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
134
+ cactus_test_definitions-1.3.0.dist-info/top_level.txt,sha256=4tQTXLPjTzH6OYZqOj40IX8XgosTUTUEJTESjtj0KfI,30
135
+ cactus_test_definitions-1.3.0.dist-info/RECORD,,
@@ -8,9 +8,33 @@ from cactus_test_definitions.errors import TestProcedureDefinitionError
8
8
  "check, is_valid",
9
9
  [
10
10
  (Check("foo", {}), False), # Unknown check
11
- (Check("readings-site-active-power", {}), False),
11
+ (Check("readings-site-active-power", {}), True),
12
12
  (Check("readings-site-active-power", {"minimum_count": "3"}), False),
13
13
  (Check("readings-site-active-power", {"minimum_count": 3}), True),
14
+ (Check("readings-site-active-power", {"minimum_count": 3, "minimum_level": 12.3}), True),
15
+ (Check("readings-site-active-power", {"minimum_count": 3, "maximum_level": 12.3}), True),
16
+ (Check("readings-site-active-power", {"minimum_count": 3, "minimum_level": 12.3, "maximum_level": 12.3}), True),
17
+ (
18
+ Check(
19
+ "readings-site-active-power",
20
+ {"minimum_count": 3, "minimum_level": 12.3, "maximum_level": 12.3, "window_seconds": 12.3},
21
+ ),
22
+ False,
23
+ ),
24
+ (
25
+ Check(
26
+ "readings-site-active-power",
27
+ {"minimum_count": 3, "minimum_level": 12.3, "maximum_level": 12.3, "window_seconds": 180},
28
+ ),
29
+ True,
30
+ ),
31
+ (
32
+ Check(
33
+ "readings-site-active-power",
34
+ {"minimum_count": 3, "minimum_level": 12.3, "maximum_level": 12.3, "window_seconds": -180},
35
+ ),
36
+ False,
37
+ ),
14
38
  (Check("der-settings-contents", {"setGradW": 27}), True),
15
39
  (Check("der-settings-contents", {"doeModesEnabled_set": "0f"}), True),
16
40
  (Check("der-settings-contents", {"doeModesEnabled_unset": "0f"}), True),