Commit 3c6507d5 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add identfication with regexps in TagCommand.

parent 57e89685
......@@ -38,6 +38,15 @@ class TagCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "")
self.assertTrue(self.todolist.is_dirty())
def test_add_tag2(self):
command = TagCommand.TagCommand(["Foo", "due", "2014-10-22"], self.todolist, self.out, self.error)
command.execute()
self.assertEquals(self.todolist.todo(1).source(), "Foo due:2014-10-22")
self.assertEquals(self.output, " 1 Foo due:2014-10-22\n")
self.assertEquals(self.errors, "")
self.assertTrue(self.todolist.is_dirty())
def test_add_tag3(self):
command = TagCommand.TagCommand(["-f", "2", "due", "2014-10-19"], self.todolist, self.out, self.error)
command.execute()
......
......@@ -48,7 +48,14 @@ class TagCommand(Command):
self.todo = self.todolist.todo(number)
self.tag = self.argument(1)
self.current_values = self.todo.tag_values(self.tag)
except (InvalidCommandArgument, InvalidTodoNumberException, TodoList.InvalidTodoException):
except InvalidTodoNumberException:
try:
self.todo = self.todolist.todo(self.argument(0))
self.tag = self.argument(1)
self.current_values = self.todo.tag_values(self.tag)
except TodoList.InvalidTodoException:
self.error("Invalid todo number.")
except (InvalidCommandArgument, TodoList.InvalidTodoException):
self.error("Invalid todo number.")
try:
......
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