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 authored and MiguelCompany committed Apr 7, 2024
1 parent 49ed271 commit 6976830
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 6976830

Please sign in to comment.