diff --git a/src/python_testing/TestMatterTestingSupport.py b/src/python_testing/TestMatterTestingSupport.py index 811349b3a96f6c..d39c869456e8f9 100644 --- a/src/python_testing/TestMatterTestingSupport.py +++ b/src/python_testing/TestMatterTestingSupport.py @@ -549,6 +549,14 @@ def test_tag_list_problems(self): problems = find_tag_list_problems(roots, device_types, simple) asserts.assert_equal(len(problems), 0, "Unexpected problems found in list") + # Tags with mfg tags + tag_mfg = Clusters.Descriptor.Structs.SemanticTagStruct(mfgCode=0xFFF1, label="test") + tag_label = Clusters.Descriptor.Structs.SemanticTagStruct(tag=1, label="test") + simple[1][Clusters.Descriptor][Clusters.Descriptor.Attributes.TagList] = [tag1, tag_mfg] + simple[2][Clusters.Descriptor][Clusters.Descriptor.Attributes.TagList] = [tag1, tag_label] + problems = find_tag_list_problems(roots, device_types, simple) + asserts.assert_equal(len(problems), 0, "Unexpected problems found in list") + def test_root_node_tag_list_functions(self): # Example topology - see comment above for the layout. # There are 4 direct children of root 0 diff --git a/src/python_testing/matter_testing_infrastructure/chip/testing/taglist_and_topology_test.py b/src/python_testing/matter_testing_infrastructure/chip/testing/taglist_and_topology_test.py index bf5c085bf84d12..eb0ab1289ee183 100644 --- a/src/python_testing/matter_testing_infrastructure/chip/testing/taglist_and_topology_test.py +++ b/src/python_testing/matter_testing_infrastructure/chip/testing/taglist_and_topology_test.py @@ -21,6 +21,7 @@ from typing import Any import chip.clusters as Clusters +from chip.clusters.Types import Nullable @dataclass @@ -143,12 +144,16 @@ def create_device_type_list_for_root(direct_children, endpoint_dict: dict[int, A def cmp_tag_list(a: Clusters.Descriptor.Structs.SemanticTagStruct, b: Clusters.Descriptor.Structs.SemanticTagStruct): + if type(a.mfgCode) != type(b.mfgCode): + return -1 if type(a.mfgCode) is Nullable else 1 if a.mfgCode != b.mfgCode: return -1 if a.mfgCode < b.mfgCode else 1 if a.namespaceID != b.namespaceID: return -1 if a.namespaceID < b.namespaceID else 1 if a.tag != b.tag: return -1 if a.tag < b.tag else 1 + if type(a.label) != type(b.label): + return -1 if type(a.label) is Nullable or a.label is None else 1 if a.label != b.label: return -1 if a.label < b.label else 1 return 0