Skip to content
Open
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
2 changes: 1 addition & 1 deletion launch_yaml/launch_yaml/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_attr(
self.__read_keys.add(name)
data = self.__element[name]
if check_is_list_entity(data_type):
if isinstance(data, list) and isinstance(data[0], dict):
if isinstance(data, list) and (not data or isinstance(data[0], dict)):
return [Entity(child, name) for child in data]
raise TypeError(
"Attribute '{}' of Entity '{}' expected to be a list of dictionaries.".format(
Expand Down
19 changes: 19 additions & 0 deletions launch_yaml/test/launch_yaml/test_include.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,24 @@ def test_include():
assert ls.context.launch_configurations['baz'] == 'BAZ'


def test_include_with_empty_argument_lists():
"""Parse an include action with explicitly empty argument lists."""
path = (Path(__file__).parent / 'executable.yaml').as_posix()
yaml_file = textwrap.dedent(
"""\
launch:
- include:
file: '{}'
arg: []
let: []
""".format(path)
)
root_entity, parser = load_no_extensions(io.StringIO(yaml_file))
ld = parser.parse_description(root_entity)

include = ld.entities[0]
assert include.launch_arguments == ()


if __name__ == '__main__':
test_include()