def get_arguments_dict(spec_args): """ Collect all ValueArgument args in dict according to arg names some-key=value will be nested in dict as: {"some": { "key": value} } For `YamlFileArgument` value is path to yaml so file content will be loaded as a nested dict. :param spec_args: Dictionary based on cmd-line args parsed from spec file :return: dict """ settings_dict = {} for _name, argument in spec_args.items(): utils.dict_insert(settings_dict, argument, *_name.split("-")) return settings_dict
def test_dict_insert(tested, val, key, expected): from cli import utils utils.dict_insert(tested, val, *key) assert tested == expected