From 804aa2e0c7db3111fec774ef872576cd30ee0969 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Tue, 2 Apr 2024 07:33:51 +0000 Subject: [PATCH] Add tests for new has_any_member_with_annotation() method Signed-off-by: Mario Dominguez --- rosidl_parser/test/test_parser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rosidl_parser/test/test_parser.py b/rosidl_parser/test/test_parser.py index 447655a17..b58f55721 100644 --- a/rosidl_parser/test/test_parser.py +++ b/rosidl_parser/test/test_parser.py @@ -203,16 +203,19 @@ 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 @@ -220,6 +223,7 @@ def test_message_parser_annotations(message_idl_file): 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'