Skip to content

Commit 4acc8fc

Browse files
Removes erroneous unmatched closing parenthesis (#125)
* Removes erroneous unmatched closing parenthesis Signed-off-by: Charles Cross <charles@missionrobotics.us> Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
1 parent 3338e1f commit 4acc8fc

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

rosidl_generator_py/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ if(BUILD_TESTING)
5656
rosidl_generate_interfaces(${PROJECT_NAME}_custom
5757
${test_interface_files_MSG_FILES}
5858
# Cases not covered by test_interface_files
59+
msg/BuiltinTypeSequencesIdl.idl
5960
msg/StringArrays.msg
6061
msg/Property.msg
6162
ADD_LINTER_TESTS
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module rosidl_generator_py {
2+
module msg {
3+
struct BuiltinTypeSequencesIdl {
4+
// Unbounded sequences
5+
sequence<char> char_sequence_unbounded;
6+
};
7+
};
8+
};

rosidl_generator_py/resource/_msg.py.em

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ bound = 2**nbits
498498
all(val >= 0 and val < @(bound) for val in value)), \
499499
@{assert_msg_suffixes.append('and each unsigned integer in [0, %d]' % (bound - 1))}@
500500
@[ elif isinstance(type_, BasicType) and type_.typename == 'char']@
501-
all(val >= 0 and val) < 256 for val in value)), \
501+
all(ord(val) >= 0 and ord(val) < 256 for val in value)), \
502502
@{assert_msg_suffixes.append('and each char in [0, 255]')}@
503503
@[ elif isinstance(type_, BasicType) and type_.typename in FLOATING_POINT_TYPES]@
504504
@[ if type_.typename == "float"]@

rosidl_generator_py/test/test_interfaces.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from rosidl_generator_py.msg import Arrays
2121
from rosidl_generator_py.msg import BasicTypes
2222
from rosidl_generator_py.msg import BoundedSequences
23+
from rosidl_generator_py.msg import BuiltinTypeSequencesIdl
2324
from rosidl_generator_py.msg import Constants
2425
from rosidl_generator_py.msg import Defaults
2526
from rosidl_generator_py.msg import Nested
@@ -916,3 +917,12 @@ def test_string_slot_types():
916917
assert isinstance(string_slot_types[4], Array)
917918
assert isinstance(string_slot_types[4].value_type, UnboundedString)
918919
assert string_slot_types[4].size == 3
920+
921+
922+
def test_builtin_sequence_slot_attributes():
923+
msg = BuiltinTypeSequencesIdl()
924+
assert hasattr(msg, 'get_fields_and_field_types')
925+
assert hasattr(msg, '__slots__')
926+
builtin_sequence_slot_types_dict = getattr(msg, 'get_fields_and_field_types')()
927+
builtin_sequence_slots = getattr(msg, '__slots__')
928+
assert len(builtin_sequence_slot_types_dict) == len(builtin_sequence_slots)

0 commit comments

Comments
 (0)