Skip to content

Commit

Permalink
fix boolean constant in Python mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Apr 22, 2019
1 parent ebad9e2 commit 14566cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rosidl_generator_py/msg/Constants.msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
bool FLAG_TRUE=true
bool FLAG_FALSE=false
int32 X=123
int32 Y=-123
string FOO=foo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def constant_value_to_py(type_, value):
assert value is not None

if isinstance(type_, BasicType):
if type_.typename == 'bool':
if type_.typename == 'boolean':
return 'True' if value else 'False'

if type_.typename in (
Expand Down
2 changes: 2 additions & 0 deletions rosidl_generator_py/test/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def test_constructor():


def test_constants():
assert Constants.FLAG_TRUE is True
assert Constants.FLAG_FALSE is False
assert 123 == Constants.X
assert -123 == Constants.Y
assert 'foo' == Constants.FOO
Expand Down

0 comments on commit 14566cb

Please sign in to comment.