mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-24 05:36:41 +02:00
util: Convert '' value into None in tw_kwargs parser
This commit is contained in:
parent
d9a0ef33d5
commit
4e782f1187
2 changed files with 4 additions and 1 deletions
|
@ -76,7 +76,7 @@ def tw_modstring_to_kwargs(line):
|
|||
# Ignore anything which is not one-word string of alpha chars
|
||||
# This will skip over constructs with attribute modifiers
|
||||
if key.isalpha():
|
||||
output[key] = value
|
||||
output[key] = value if value is not "" else None
|
||||
# Tag addition
|
||||
elif arg.startswith('+'):
|
||||
value = arg[1:]
|
||||
|
|
|
@ -37,6 +37,9 @@ class TestParsingModstrings(object):
|
|||
def test_modstring_to_kwargs_with_simple_tag(self):
|
||||
assert util.tw_modstring_to_kwargs("+test ") == {"tags":["test"]}
|
||||
|
||||
def test_modstring_to_kwargs_with_removal(self):
|
||||
assert util.tw_modstring_to_kwargs("project: +work") == {"tags":["work"], "project":None}
|
||||
|
||||
def test_modstring_to_kwargs_with_spaces(self):
|
||||
assert util.tw_modstring_to_kwargs("project:Random area:admin") == {"project":"Random", "area":"admin"}
|
||||
assert util.tw_modstring_to_kwargs("project:Random +test") == {"project":"Random", "tags":["test"]}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue