Skip to content

Commit

Permalink
Removes erroneous unmatched closing parenthesis (#125)
Browse files Browse the repository at this point in the history
* Removes erroneous unmatched closing parenthesis

Signed-off-by: Charles Cross <charles@missionrobotics.us>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
(cherry picked from commit 4acc8fc)
  • Loading branch information
spiderkeys authored and mergify-bot committed Apr 22, 2022
1 parent 2994d40 commit a031a5b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
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)

0 comments on commit a031a5b

Please sign in to comment.