Updated YAML Parser code to consider wait as command (#28818)
diff --git a/examples/placeholder/py_matter_placeholder_adapter/matter_placeholder_adapter/adapter.py b/examples/placeholder/py_matter_placeholder_adapter/matter_placeholder_adapter/adapter.py
index 8073282..da92f09 100644
--- a/examples/placeholder/py_matter_placeholder_adapter/matter_placeholder_adapter/adapter.py
+++ b/examples/placeholder/py_matter_placeholder_adapter/matter_placeholder_adapter/adapter.py
@@ -72,6 +72,8 @@
clusterId = json_response[_CLUSTER_ID]
decoded_response[_COMMAND] = self.__definitions.get_response_name(
clusterId, value)
+ if not decoded_response[_COMMAND]:
+ decoded_response[_COMMAND] = self.__definitions.get_command_name(clusterId, value)
elif key == _ATTRIBUTE_ID:
clusterId = json_response[_CLUSTER_ID]
decoded_response[_ATTRIBUTE] = self.__definitions.get_attribute_name(
diff --git a/scripts/py_matter_yamltests/matter_yamltests/parser.py b/scripts/py_matter_yamltests/matter_yamltests/parser.py
index b5743b8..6cebea1 100644
--- a/scripts/py_matter_yamltests/matter_yamltests/parser.py
+++ b/scripts/py_matter_yamltests/matter_yamltests/parser.py
@@ -189,6 +189,8 @@
self.group_id = _value_or_config(test, 'groupId', config)
self.cluster = _value_or_config(test, 'cluster', config)
self.command = _value_or_config(test, 'command', config)
+ if not self.command:
+ self.command = _value_or_config(test, 'wait', config)
self.attribute = _value_or_none(test, 'attribute')
self.event = _value_or_none(test, 'event')
self.endpoint = _value_or_config(test, 'endpoint', config)
@@ -786,8 +788,12 @@
expected_wait_type
]
+ wait_for_str = received_response.get('wait_for')
+ if not wait_for_str:
+ wait_for_str = received_response.get('command')
+
received_values = [
- received_response.get('wait_for'),
+ wait_for_str,
received_response.get('endpoint'),
received_response.get('cluster'),
received_wait_type
diff --git a/scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py b/scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py
index efc6adc..5f1352c 100644
--- a/scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py
+++ b/scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py
@@ -266,7 +266,9 @@
def __rule_argument_value_is_only_when_writing_attributes(self, content):
if 'arguments' in content:
- command = content.get('command')
+ operation = content.get('command')
+ if not operation:
+ operation = content.get('wait')
arguments = content.get('arguments')
- if 'value' in arguments and command != 'writeAttribute':
+ if 'value' in arguments and operation != 'writeAttribute':
raise TestStepArgumentsValueError(content)