File test/config_types.py from the latest check-in


# type: test
# title: type mapping
# description: test for common types in config:
# config:
#   { name: s1, type: string, value: 1 }
#   { name: s2, type: boolean, value: 1 }
#   { name: s3, type: longstr, value: … }
#   { name: s4, type: number, value: 1 }
#   { name: s5, type: decimal, value: 1 }
#   { name: s6, type: choice, value: 1 }
# version: 0.1
# 
# Do all the settings!

import pytest
import pluginconf

pluginconf.config_opt_type_map.update({
    "decimal": "int",
})


@pytest.fixture
def config():
    return pluginconf.plugin_meta(fn=__file__)["config"]
    
@pytest.mark.parametrize("nam,typ", [
        ("s1", "str"),
        ("s2", "bool"),
        ("s3", "text"),
        ("s4", "int"),
        ("s5", "int"),
        ("s6", "select"),
])
def check_types(config, nam, typ):
    for opt in config:
        if opt["name"] == nam:
            assert opt["type"] == typ