def test_setting_spec__serialize__default(): default = { "action": None, "choices": None, "dest": None, "flags": None, "group": SettingType.PARAMETER, "help": None, "nargs": None, "type": None, } setting_spec = SettingSpec(SettingType.PARAMETER) assert setting_spec.as_dict() == default
def test_setting_spec__serialize__override(): spec = { "action": "count", "choices": ["a", "b", "c"], "dest": "foo", "flags": ["-f", "--foo"], "group": SettingType.PARAMETER, "help": "foos your bars", "nargs": "+", "type": int, } setting_spec = SettingSpec(**spec) assert setting_spec.as_dict() == spec