Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes erroneous unmatched closing parenthesis (backport #125) #158

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rosidl_generator_py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ if(BUILD_TESTING)
rosidl_generate_interfaces(${PROJECT_NAME}_custom
${test_interface_files_MSG_FILES}
# Cases not covered by test_interface_files
msg/BuiltinTypeSequencesIdl.idl
msg/StringArrays.msg
ADD_LINTER_TESTS
SKIP_INSTALL
Expand Down
8 changes: 8 additions & 0 deletions rosidl_generator_py/msg/BuiltinTypeSequencesIdl.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module rosidl_generator_py {
module msg {
struct BuiltinTypeSequencesIdl {
// Unbounded sequences
sequence<char> char_sequence_unbounded;
};
};
};
2 changes: 1 addition & 1 deletion rosidl_generator_py/resource/_msg.py.em
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ bound = 2**nbits
all(val >= 0 and val < @(bound) for val in value)), \
@{assert_msg_suffixes.append('and each unsigned integer in [0, %d]' % (bound - 1))}@
@[ elif isinstance(type_, BasicType) and type_.typename == 'char']@
all(val >= 0 and val) < 256 for val in value)), \
all(ord(val) >= 0 and ord(val) < 256 for val in value)), \
@{assert_msg_suffixes.append('and each char in [0, 255]')}@
@[ else]@
True), \
Expand Down
10 changes: 10 additions & 0 deletions rosidl_generator_py/test/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from rosidl_generator_py.msg import Arrays
from rosidl_generator_py.msg import BasicTypes
from rosidl_generator_py.msg import BoundedSequences
from rosidl_generator_py.msg import BuiltinTypeSequencesIdl
from rosidl_generator_py.msg import Constants
from rosidl_generator_py.msg import Defaults
from rosidl_generator_py.msg import Nested
Expand Down Expand Up @@ -896,3 +897,12 @@ def test_string_slot_types():
assert isinstance(string_slot_types[4], Array)
assert isinstance(string_slot_types[4].value_type, UnboundedString)
assert string_slot_types[4].size == 3


def test_builtin_sequence_slot_attributes():
msg = BuiltinTypeSequencesIdl()
assert hasattr(msg, 'get_fields_and_field_types')
assert hasattr(msg, '__slots__')
builtin_sequence_slot_types_dict = getattr(msg, 'get_fields_and_field_types')()
builtin_sequence_slots = getattr(msg, '__slots__')
assert len(builtin_sequence_slot_types_dict) == len(builtin_sequence_slots)