def test_config_lines(leaf_bool_pragma_string_w_semicolon, leaf_bool_pragma_string_single_line, model_set): if model_set == 0: string = leaf_bool_pragma_string_w_semicolon test = [ {'title': 'pv', 'tag': 'TEST:MAIN:NEW_VAR_OUT'}, {'title': 'type', 'tag': 'bo'}, {'title': 'field', 'tag': dict(f_name='ZNAM', f_set='SINGLE')}, {'title': 'field', 'tag': dict(f_name='ONAM', f_set='MULTI')}, {'title': 'field', 'tag': dict(f_name='SCAN', f_set='1 second')}, {'title': 'str', 'tag': '%d'}, {'title': 'io', 'tag': 'o'}, {'title': 'init', 'tag': 'True'}, {'title': 'pv', 'tag': 'TEST:MAIN:NEW_VAR_IN'}, {'title': 'type', 'tag': 'bi'}, {'title': 'field', 'tag': dict(f_name='ZNAM', f_set='SINGLE')}, {'title': 'field', 'tag': dict(f_name='ONAM', f_set='MULTI')}, {'title': 'field', 'tag': dict(f_name='SCAN', f_set='1 second')}, {'title': 'str', 'tag': '%d'}, {'title': 'io', 'tag': 'i'}, {'title': 'ensure', 'tag': 'that'}, {'title': 'semicolons', 'tag': 'work'}, ] if model_set == 1: string = leaf_bool_pragma_string_single_line test = [{'title': "pv", 'tag': 'pv_name'}] assert split_pytmc_pragma(string) == test
def test_config_names(leaf_bool_pragma_string): config_lines = split_pytmc_pragma(leaf_bool_pragma_string) configs = dict(separate_configs_by_pv(config_lines)) assert set(configs) == { "TEST:MAIN:NEW_VAR_OUT", "TEST:MAIN:NEW_VAR_IN" }
def test_fix_to_config_name(leaf_bool_pragma_string): config_lines = split_pytmc_pragma(leaf_bool_pragma_string) configs = dict(separate_configs_by_pv(config_lines)) assert configs['TEST:MAIN:NEW_VAR_OUT'] == [ {'title': 'pv', 'tag': 'TEST:MAIN:NEW_VAR_OUT'}, {'title': 'type', 'tag': 'bo'}, {'title': 'field', 'tag': {'f_name': 'ZNAM', 'f_set': 'SINGLE'}}, {'title': 'field', 'tag': {'f_name': 'ONAM', 'f_set': 'MULTI'}}, {'title': 'field', 'tag': {'f_name': 'SCAN', 'f_set': '1 second'}}, {'title': 'str', 'tag': '%d'}, {'title': 'io', 'tag': 'o'}, {'title': 'init', 'tag': 'True'}, ]
def test_formatted_config_lines(leaf_bool_pragma_string): config_lines = split_pytmc_pragma(leaf_bool_pragma_string) assert config_lines == [ {'title': 'pv', 'tag': 'TEST:MAIN:NEW_VAR_OUT'}, {'title': 'type', 'tag': 'bo'}, {'title': 'field', 'tag': {'f_name': 'ZNAM', 'f_set': 'SINGLE'}}, {'title': 'field', 'tag': {'f_name': 'ONAM', 'f_set': 'MULTI'}}, {'title': 'field', 'tag': {'f_name': 'SCAN', 'f_set': '1 second'}}, {'title': 'str', 'tag': '%d'}, {'title': 'io', 'tag': 'o'}, {'title': 'init', 'tag': 'True'}, {'title': 'pv', 'tag': 'TEST:MAIN:NEW_VAR_IN'}, {'title': 'type', 'tag': 'bi'}, {'title': 'field', 'tag': {'f_name': 'ZNAM', 'f_set': 'SINGLE'}}, {'title': 'field', 'tag': {'f_name': 'ONAM', 'f_set': 'MULTI'}}, {'title': 'field', 'tag': {'f_name': 'SCAN', 'f_set': '1 second'}}, {'title': 'str', 'tag': '%d'}, {'title': 'io', 'tag': 'i'}, ]
def test_neaten_field(leaf_bool_pragma_string): config_lines = split_pytmc_pragma(leaf_bool_pragma_string) assert config_lines[2]['tag'] == {'f_name': 'ZNAM', 'f_set': 'SINGLE'}