예제 #1
0
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
예제 #2
0
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"
    }
예제 #3
0
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'},
    ]
예제 #4
0
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'},
    ]
예제 #5
0
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'}