Fix handling of none_ok in List/Dict
We now always return None (and '' as string) when the user configured an empty list or dict.
This commit is contained in:
parent
8ea3d92697
commit
41655e7852
@ -21,6 +21,7 @@ yank_ignored_url_parameters:
|
|||||||
type:
|
type:
|
||||||
name: List
|
name: List
|
||||||
valtype: String
|
valtype: String
|
||||||
|
none_ok: true
|
||||||
default:
|
default:
|
||||||
- ref
|
- ref
|
||||||
- utm_source
|
- utm_source
|
||||||
@ -1232,6 +1233,7 @@ hints.hide_unmatched_rapid_hints:
|
|||||||
|
|
||||||
searchengines:
|
searchengines:
|
||||||
default:
|
default:
|
||||||
|
# FIXME:conf what if the user deletes/renames DEFAULT?
|
||||||
DEFAULT: https://duckduckgo.com/?q={}
|
DEFAULT: https://duckduckgo.com/?q={}
|
||||||
type:
|
type:
|
||||||
name: Dict
|
name: Dict
|
||||||
@ -1249,6 +1251,7 @@ aliases:
|
|||||||
name: String
|
name: String
|
||||||
forbidden: ' '
|
forbidden: ' '
|
||||||
valtype: Command
|
valtype: Command
|
||||||
|
none_ok: true
|
||||||
desc: Command aliases FIXME
|
desc: Command aliases FIXME
|
||||||
|
|
||||||
# colors
|
# colors
|
||||||
|
@ -573,7 +573,8 @@ class TestList:
|
|||||||
except configexc.ValidationError:
|
except configexc.ValidationError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
assert typ.to_str(converted) == text
|
expected = '' if not val else text
|
||||||
|
assert typ.to_str(converted) == expected
|
||||||
|
|
||||||
|
|
||||||
class TestFlagList:
|
class TestFlagList:
|
||||||
@ -1407,7 +1408,8 @@ class TestDict:
|
|||||||
except configexc.ValidationError:
|
except configexc.ValidationError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
assert d.to_str(converted) == text
|
expected = '' if not val else text
|
||||||
|
assert d.to_str(converted) == expected
|
||||||
|
|
||||||
|
|
||||||
def unrequired_class(**kwargs):
|
def unrequired_class(**kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user