Skip to content

Commit

Permalink
[matter_yamltests] Stop failing is no definitions is used for matter_…
Browse files Browse the repository at this point in the history
…yamltests (#25021)
  • Loading branch information
vivien-apple authored and pull[bot] committed Jan 27, 2024
1 parent 3eafa1f commit 6127332
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions scripts/py_matter_yamltests/matter_yamltests/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,33 +253,34 @@ def __init__(self, test: dict, config: dict, definitions: SpecDefinitions, pics_
response_mapping = None
response_mapping_name = None

if self.is_attribute:
attribute = definitions.get_attribute_by_name(
self.cluster, self.attribute)
if attribute:
attribute_mapping = self._as_mapping(definitions, self.cluster,
attribute.definition.data_type.name)
argument_mapping = attribute_mapping
response_mapping = attribute_mapping
response_mapping_name = attribute.definition.data_type.name
elif self.is_event:
event = definitions.get_event_by_name(
self.cluster, self.event)
if event:
event_mapping = self._as_mapping(definitions, self.cluster,
event.name)
argument_mapping = event_mapping
response_mapping = event_mapping
response_mapping_name = event.name
else:
command = definitions.get_command_by_name(
self.cluster, self.command)
if command:
argument_mapping = self._as_mapping(
definitions, self.cluster, command.input_param)
response_mapping = self._as_mapping(
definitions, self.cluster, command.output_param)
response_mapping_name = command.output_param
if definitions is not None:
if self.is_attribute:
attribute = definitions.get_attribute_by_name(
self.cluster, self.attribute)
if attribute:
attribute_mapping = self._as_mapping(definitions, self.cluster,
attribute.definition.data_type.name)
argument_mapping = attribute_mapping
response_mapping = attribute_mapping
response_mapping_name = attribute.definition.data_type.name
elif self.is_event:
event = definitions.get_event_by_name(
self.cluster, self.event)
if event:
event_mapping = self._as_mapping(definitions, self.cluster,
event.name)
argument_mapping = event_mapping
response_mapping = event_mapping
response_mapping_name = event.name
else:
command = definitions.get_command_by_name(
self.cluster, self.command)
if command:
argument_mapping = self._as_mapping(
definitions, self.cluster, command.input_param)
response_mapping = self._as_mapping(
definitions, self.cluster, command.output_param)
response_mapping_name = command.output_param

self.argument_mapping = argument_mapping
self.response_mapping = response_mapping
Expand Down

0 comments on commit 6127332

Please sign in to comment.