Commit 8fd0a6ff authored by Bram Schoenmakers's avatar Bram Schoenmakers

Don't try to convert to linenumber when a textual UID is passed

When a UID of 1aa is passed, the code path would try to convert it to a
linenumber (integer) when linenumbers are configured. That fails and
should be caught accordingly.
parent 0980d459
......@@ -219,6 +219,13 @@ class TodoListTester(TopydoTest):
config("test/data/todolist-uid.conf")
self.assertRaises(InvalidTodoException, self.todolist.todo, 1)
def test_uid4(self):
"""
Handle UIDs properly when line numbers are configured.
"""
config(p_overrides={('topydo', 'identifiers'): 'linenumber'})
self.assertRaises(InvalidTodoException, self.todolist.todo, '11a')
def test_new_uid(self):
""" Make sure that item has new text ID after append. """
config("test/data/todolist-uid.conf")
......
......@@ -98,7 +98,7 @@ class TodoListBase(object):
except TypeError:
try:
result = self._todos[int(p_identifier) - 1]
except IndexError:
except (ValueError, IndexError):
raise InvalidTodoException
return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment