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:
Florian Bruhin 2017-06-15 18:04:48 +02:00
parent 8ea3d92697
commit 41655e7852
2 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,7 @@ yank_ignored_url_parameters:
type:
name: List
valtype: String
none_ok: true
default:
- ref
- utm_source
@ -1232,6 +1233,7 @@ hints.hide_unmatched_rapid_hints:
searchengines:
default:
# FIXME:conf what if the user deletes/renames DEFAULT?
DEFAULT: https://duckduckgo.com/?q={}
type:
name: Dict
@ -1249,6 +1251,7 @@ aliases:
name: String
forbidden: ' '
valtype: Command
none_ok: true
desc: Command aliases FIXME
# colors

View File

@ -573,7 +573,8 @@ class TestList:
except configexc.ValidationError:
pass
else:
assert typ.to_str(converted) == text
expected = '' if not val else text
assert typ.to_str(converted) == expected
class TestFlagList:
@ -1407,7 +1408,8 @@ class TestDict:
except configexc.ValidationError:
pass
else:
assert d.to_str(converted) == text
expected = '' if not val else text
assert d.to_str(converted) == expected
def unrequired_class(**kwargs):