Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille authored and PeterC1965 committed Aug 28, 2024
1 parent bc0bcb0 commit 2d25404
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/python_testing/matter_testing_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2d25404

Please sign in to comment.