From b12dbc352ef402c473ab6cf06a657c620c37c346 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Thu, 2 Feb 2023 11:38:18 -0500 Subject: [PATCH] Fix issue where CI is failing because pseduo cluster does not have response mapping (#24823) --- .../py_matter_yamltests/matter_yamltests/parser.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/py_matter_yamltests/matter_yamltests/parser.py b/scripts/py_matter_yamltests/matter_yamltests/parser.py index cb17d7a35846f8..9c5b6247380d5f 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/parser.py +++ b/scripts/py_matter_yamltests/matter_yamltests/parser.py @@ -690,14 +690,21 @@ def _response_constraints_validation(self, response, result): received_value = response.get('value') if not self.is_attribute: expected_name = value.get('name') - response_type_name = self._test.response_mapping.get( - expected_name) if received_value is None or expected_name not in received_value: received_value = None else: received_value = received_value.get( expected_name) if received_value else None + if self._test.response_mapping: + response_type_name = self._test.response_mapping.get( + expected_name) + else: + # We don't have a mapping for this type. This happens for pseduo clusters. + # If there is a constraint check for the type it is likely an incorrect + # constraint check by the test writter. + response_type_name = None + constraints = get_constraints(value['constraints']) if all([constraint.is_met(received_value, response_type_name) for constraint in constraints]):