From 2d254041f738a6389531cb53816aa7f089aecd11 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 23 Aug 2024 04:23:38 -0400 Subject: [PATCH] check (#34998) --- src/python_testing/matter_testing_support.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index d3d810149ce5dd..4127ead64c3083 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -1838,6 +1838,14 @@ def whole_node_runner(self: MatterBaseTest, *args, **kwargs): EndpointCheckFunction = typing.Callable[[Clusters.Attribute.AsyncReadTransaction.ReadResponse, int], bool] +def get_cluster_from_attribute(attribute: ClusterObjects.ClusterAttributeDescriptor) -> ClusterObjects.Cluster: + return ClusterObjects.ALL_CLUSTERS[attribute.cluster_id] + + +def get_cluster_from_command(command: ClusterObjects.ClusterCommand) -> ClusterObjects.Cluster: + return ClusterObjects.ALL_CLUSTERS[command.cluster_id] + + def _has_cluster(wildcard, endpoint, cluster: ClusterObjects.Cluster) -> bool: try: return cluster in wildcard.attributes[endpoint] @@ -1870,7 +1878,7 @@ def has_cluster(cluster: ClusterObjects.ClusterObjectDescriptor) -> EndpointChec def _has_attribute(wildcard, endpoint, attribute: ClusterObjects.ClusterAttributeDescriptor) -> bool: - cluster = getattr(Clusters, attribute.__qualname__.split('.')[-3]) + cluster = get_cluster_from_attribute(attribute) try: attr_list = wildcard.attributes[endpoint][cluster][cluster.Attributes.AttributeList] return attribute.attribute_id in attr_list