Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d14311f

Browse files
committedJul 8, 2024·
remove equality operator and check the member directly
1 parent 0ec0545 commit d14311f

File tree

3 files changed

+129
-136
lines changed

3 files changed

+129
-136
lines changed
 

‎src/python_testing/TC_DeviceConformance.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ def record_warning(location, problem):
119119
if cluster_id in ignore_features and f in ignore_features[cluster_id]:
120120
continue
121121
xml_feature = self.xml_clusters[cluster_id].features[f]
122-
conformance_decision = xml_feature.conformance(feature_map, attribute_list, all_command_list)
123-
if not conformance_allowed(conformance_decision, allow_provisional):
122+
conformance_decision_with_choice = xml_feature.conformance(feature_map, attribute_list, all_command_list)
123+
if not conformance_allowed(conformance_decision_with_choice, allow_provisional):
124124
record_error(location=location, problem=f'Disallowed feature with mask 0x{f:02x}')
125125
for feature_mask, xml_feature in self.xml_clusters[cluster_id].features.items():
126126
if cluster_id in ignore_features and feature_mask in ignore_features[cluster_id]:
127127
continue
128-
conformance_decision = xml_feature.conformance(feature_map, attribute_list, all_command_list)
129-
if conformance_decision == ConformanceDecision.MANDATORY and feature_mask not in feature_masks:
128+
conformance_decision_with_choice = xml_feature.conformance(feature_map, attribute_list, all_command_list)
129+
if conformance_decision_with_choice.decision == ConformanceDecision.MANDATORY and feature_mask not in feature_masks:
130130
record_error(
131131
location=location, problem=f'Required feature with mask 0x{f:02x} is not present in feature map. {conformance_str(xml_feature.conformance, feature_map, self.xml_clusters[cluster_id].features)}')
132132

@@ -142,16 +142,16 @@ def record_warning(location, problem):
142142
record_error(location=location, problem='Standard attribute found on device, but not in spec')
143143
continue
144144
xml_attribute = self.xml_clusters[cluster_id].attributes[attribute_id]
145-
conformance_decision = xml_attribute.conformance(feature_map, attribute_list, all_command_list)
146-
if not conformance_allowed(conformance_decision, allow_provisional):
145+
conformance_decision_with_choice = xml_attribute.conformance(feature_map, attribute_list, all_command_list)
146+
if not conformance_allowed(conformance_decision_with_choice, allow_provisional):
147147
location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, attribute_id=attribute_id)
148148
record_error(
149149
location=location, problem=f'Attribute 0x{attribute_id:02x} is included, but is disallowed by conformance. {conformance_str(xml_attribute.conformance, feature_map, self.xml_clusters[cluster_id].features)}')
150150
for attribute_id, xml_attribute in self.xml_clusters[cluster_id].attributes.items():
151151
if cluster_id in ignore_attributes and attribute_id in ignore_attributes[cluster_id]:
152152
continue
153-
conformance_decision = xml_attribute.conformance(feature_map, attribute_list, all_command_list)
154-
if conformance_decision == ConformanceDecision.MANDATORY and attribute_id not in cluster.keys():
153+
conformance_decision_with_choice = xml_attribute.conformance(feature_map, attribute_list, all_command_list)
154+
if conformance_decision_with_choice.decision == ConformanceDecision.MANDATORY and attribute_id not in cluster.keys():
155155
location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, attribute_id=attribute_id)
156156
record_error(
157157
location=location, problem=f'Attribute 0x{attribute_id:02x} is required, but is not present on the DUT. {conformance_str(xml_attribute.conformance, feature_map, self.xml_clusters[cluster_id].features)}')
@@ -170,13 +170,13 @@ def check_spec_conformance_for_commands(command_type: CommandType):
170170
record_error(location=location, problem='Standard command found on device, but not in spec')
171171
continue
172172
xml_command = xml_commands_dict[command_id]
173-
conformance_decision = xml_command.conformance(feature_map, attribute_list, all_command_list)
174-
if not conformance_allowed(conformance_decision, allow_provisional):
173+
conformance_decision_with_choice = xml_command.conformance(feature_map, attribute_list, all_command_list)
174+
if not conformance_allowed(conformance_decision_with_choice, allow_provisional):
175175
record_error(
176176
location=location, problem=f'Command 0x{command_id:02x} is included, but disallowed by conformance. {conformance_str(xml_command.conformance, feature_map, self.xml_clusters[cluster_id].features)}')
177177
for command_id, xml_command in xml_commands_dict.items():
178-
conformance_decision = xml_command.conformance(feature_map, attribute_list, all_command_list)
179-
if conformance_decision == ConformanceDecision.MANDATORY and command_id not in command_list:
178+
conformance_decision_with_choice = xml_command.conformance(feature_map, attribute_list, all_command_list)
179+
if conformance_decision_with_choice.decision == ConformanceDecision.MANDATORY and command_id not in command_list:
180180
location = CommandPathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, command_id=command_id)
181181
record_error(
182182
location=location, problem=f'Command 0x{command_id:02x} is required, but is not present on the DUT. {conformance_str(xml_command.conformance, feature_map, self.xml_clusters[cluster_id].features)}')

0 commit comments

Comments
 (0)
Please sign in to comment.