Skip to content

Commit

Permalink
Add tests for new has_any_member_with_annotation() method
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL committed Apr 2, 2024
1 parent 72cf5d7 commit 804aa2e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rosidl_parser/test/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,27 @@ def test_message_parser_annotations(message_idl_file):
assert structure.annotations[1].value == 'SHMEM_REF'

assert len(structure.members[2].annotations) == 1
assert structure.has_any_member_with_annotation('autoid') is False

assert structure.members[2].annotations[0].name == 'default'
assert len(structure.members[2].annotations[0].value) == 1
assert 'value' in structure.members[2].annotations[0].value
assert structure.members[2].annotations[0].value['value'] == 123
assert structure.has_any_member_with_annotation('default')

assert len(structure.members[3].annotations) == 2

assert structure.members[3].annotations[0].name == 'key'
assert structure.members[3].annotations[0].value is None
assert structure.has_any_member_with_annotation('key')

assert structure.members[3].annotations[1].name == 'range'
assert len(structure.members[3].annotations[1].value) == 2
assert 'min' in structure.members[3].annotations[1].value
assert structure.members[3].annotations[1].value['min'] == -10
assert 'max' in structure.members[3].annotations[1].value
assert structure.members[3].annotations[1].value['max'] == 10
assert structure.has_any_member_with_annotation('range')

assert isinstance(structure.members[32].type, BasicType)
assert structure.members[32].type.typename == 'float'
Expand Down

0 comments on commit 804aa2e

Please sign in to comment.