Skip to content

Commit 2d25404

Browse files
cecillePeterC1965
authored andcommitted
1 parent bc0bcb0 commit 2d25404

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/python_testing/matter_testing_support.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,14 @@ def whole_node_runner(self: MatterBaseTest, *args, **kwargs):
18381838
EndpointCheckFunction = typing.Callable[[Clusters.Attribute.AsyncReadTransaction.ReadResponse, int], bool]
18391839

18401840

1841+
def get_cluster_from_attribute(attribute: ClusterObjects.ClusterAttributeDescriptor) -> ClusterObjects.Cluster:
1842+
return ClusterObjects.ALL_CLUSTERS[attribute.cluster_id]
1843+
1844+
1845+
def get_cluster_from_command(command: ClusterObjects.ClusterCommand) -> ClusterObjects.Cluster:
1846+
return ClusterObjects.ALL_CLUSTERS[command.cluster_id]
1847+
1848+
18411849
def _has_cluster(wildcard, endpoint, cluster: ClusterObjects.Cluster) -> bool:
18421850
try:
18431851
return cluster in wildcard.attributes[endpoint]
@@ -1870,7 +1878,7 @@ def has_cluster(cluster: ClusterObjects.ClusterObjectDescriptor) -> EndpointChec
18701878

18711879

18721880
def _has_attribute(wildcard, endpoint, attribute: ClusterObjects.ClusterAttributeDescriptor) -> bool:
1873-
cluster = getattr(Clusters, attribute.__qualname__.split('.')[-3])
1881+
cluster = get_cluster_from_attribute(attribute)
18741882
try:
18751883
attr_list = wildcard.attributes[endpoint][cluster][cluster.Attributes.AttributeList]
18761884
return attribute.attribute_id in attr_list

0 commit comments

Comments
 (0)