diff --git a/launch_yaml/launch_yaml/entity.py b/launch_yaml/launch_yaml/entity.py index 93e262688..5d44f77df 100644 --- a/launch_yaml/launch_yaml/entity.py +++ b/launch_yaml/launch_yaml/entity.py @@ -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( diff --git a/launch_yaml/test/launch_yaml/test_include.py b/launch_yaml/test/launch_yaml/test_include.py index 89197fcb4..148b8f260 100644 --- a/launch_yaml/test/launch_yaml/test_include.py +++ b/launch_yaml/test/launch_yaml/test_include.py @@ -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()