Skip to content

Commit

Permalink
Python testing: Handle provisional aliased clusters (#37192)
Browse files Browse the repository at this point in the history
Handle the case where there are cluster aliases, and only some
of the aliased clusters are provisional. This is a weird case that
only happens in the 1.3 spec, which was before we handled provisional
in the automated testing.

Test: See attached unit tests. Level control is now correctly marked
      in 1.3.
  • Loading branch information
cecille authored Jan 25, 2025
1 parent 5dee683 commit 8ef6bb4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/python_testing/TestSpecParsingSupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ def get_access_enum_from_string(access_str: str) -> Clusters.AccessControl.Enums
' </revisionHistory>'
' <clusterIds>'
' <clusterId id="0xFFFE" name="Test Alias1"/>'
' <clusterId id="0xFFFD" name="Test Alias2"/>'
' <clusterId id="0xFFFD" name="Test Alias2">'
' <provisionalConform/>'
' </clusterId>'
' </clusterIds>'
' <classification hierarchy="base" role="application" picsCode="BASE" scope="Endpoint"/>'
' <commands>'
Expand Down Expand Up @@ -396,6 +398,10 @@ def test_aliased_clusters(self):
asserts.assert_true((0xFFFE, 'Test Alias1') in ids, "Unable to find Test Alias1 cluster in parsed clusters")
asserts.assert_true((0xFFFD, 'Test Alias2') in ids, "Unable to find Test Alias2 cluster in parsed clusters")

# Test Alias2 is marked as provisional, and TestAlias1 is not
asserts.assert_false(clusters[0xFFFE].is_provisional, "Test Alias1 is marked as provisional and should not be")
asserts.assert_true(clusters[0xFFFD].is_provisional, "Test Alias2 is not marked as provisional and should be")

def test_known_aliased_clusters(self):
known_aliased_clusters = set([(0x040C, 'Carbon Monoxide Concentration Measurement', 'CMOCONC'),
(0x040D, 'Carbon Dioxide Concentration Measurement', 'CDOCONC'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,10 @@ def __init__(self, cluster: ElementTree.Element, cluster_id: Optional[uint], nam
except (KeyError, StopIteration):
self._derived = None

for id in cluster.iter('clusterIds'):
if list(id.iter('provisionalConform')):
self._is_provisional = True
for ids in cluster.iter('clusterIds'):
for id in ids.iter('clusterId'):
if id.attrib['name'] == name and list(id.iter('provisionalConform')):
self._is_provisional = True

self._pics: Optional[str] = None
try:
Expand Down

0 comments on commit 8ef6bb4

Please sign in to comment.