Skip to content

Commit

Permalink
[MatterYamlTests] null values that are saved are not substituted when…
Browse files Browse the repository at this point in the history
… the key used to saved them is used
  • Loading branch information
Vivien Nicolas authored and Vivien Nicolas committed Sep 7, 2023
1 parent 3f7d03c commit 6918760
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/py_matter_yamltests/matter_yamltests/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,9 +1080,8 @@ def _config_variable_substitution(self, value):
variable_info = self._runtime_config_variable_storage[token]
if type(variable_info) is dict and 'defaultValue' in variable_info:
variable_info = variable_info['defaultValue']
if variable_info is not None:
tokens[idx] = variable_info
substitution_occured = True
tokens[idx] = variable_info
substitution_occured = True

if len(tokens) == 1:
return tokens[0]
Expand Down
35 changes: 35 additions & 0 deletions src/app/tests/suites/TestSaveAs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -802,3 +802,38 @@ tests:
attribute: "octet_string"
arguments:
value: readAttributeOctetStringDefaultValue

# Tests for null values
- label: "Read attribute nullable_boolean Default Value"
command: "readAttribute"
attribute: "nullable_boolean"
response:
saveAs: readAttributeNullableBooleanDefaultValue
value: false

- label: "Write attribute nullable_boolean to null"
command: "writeAttribute"
attribute: "nullable_boolean"
arguments:
value: null

- label: "Read attribute nullable_boolean null Value"
command: "readAttribute"
attribute: "nullable_boolean"
response:
saveAs: readAttributeNullableBooleanNullValue
value: null

- label:
"Read attribute nullable_boolean null Value again and compare it to
the previously saved value"
command: "readAttribute"
attribute: "nullable_boolean"
response:
value: readAttributeNullableBooleanNullValue

- label: "Write attribute nullable_boolean Default Value"
command: "writeAttribute"
attribute: "nullable_boolean"
arguments:
value: readAttributeNullableBooleanDefaultValue

0 comments on commit 6918760

Please sign in to comment.