Beispiel #1
0
    def test_complete(self):
        """completion"""
        todo_line = "x foo bar +proj1 +proj2 @context tag:value"
        task = Task.parse(todo_line)
        self.assertEqual(task.done, True)
        self.assertEqual(task.finish, None)

        todo_line = "x 2013-12-15 foo bar +proj1 +proj2 @context tag:value"
        task = Task.parse(todo_line)
        self.assertEqual(task.done, True)
        self.assertEqual(task.finish, date(2013,12,15))
Beispiel #2
0
 def test_dates(self):
     """date handling"""
     todo_line = "2010-2-23 foo bar +proj1 +proj2 @context tag:value"
     task = Task.parse(todo_line)
     self.assertEqual(task.create, date(2010,2,23))
     todo_line = "x 2010-2-23 foo bar +proj1 +proj2 @context tag:value"
     task = Task.parse(todo_line)
     self.assertEqual(task.finish, date(2010,2,23))
     self.assertEqual(task.create, None)
     todo_line = "x 2010-2-23 2010-2-22 foo bar +proj1 +proj2 @context tag:value"
     task = Task.parse(todo_line)
     self.assertEqual(task.finish, date(2010,2,23))
     self.assertEqual(task.create, date(2010,2,22))
Beispiel #3
0
    def test_leading_space(self):
        """leading spaces"""
        todo_line = " foo bar +proj1 +proj2 @context tag:value"
        task = Task.parse(todo_line)
        self.assertEqual(task.priority, "")
        self.assertEqual(task.create, None)
        self.assertEqual(task.finish, None)
        self.assertEqual(task.done, False)
        self.assertEqual(task.task, " foo bar")
        self.assertEqual(set(task.projects), set(["+proj1", "+proj2"]))
        self.assertEqual(set(task.contexts), set(["@context"]))
        self.assertEqual(task.tags, {"tag":"value"})

        todo_line = " (A) foo bar +proj1 +proj2 @context tag:value"
        task = Task.parse(todo_line)
        self.assertEqual(task.priority, "")
        self.assertEqual(task.create, None)
        self.assertEqual(task.finish, None)
        self.assertEqual(task.done, False)
        self.assertEqual(task.task, " (A) foo bar")
        self.assertEqual(set(task.projects), set(["+proj1", "+proj2"]))
        self.assertEqual(set(task.contexts), set(["@context"]))
        self.assertEqual(task.tags, {"tag":"value"})

        todo_line = " x foo bar +proj1 +proj2 @context tag:value"
        task = Task.parse(todo_line)
        self.assertEqual(task.priority, "")
        self.assertEqual(task.create, None)
        self.assertEqual(task.finish, None)
        self.assertEqual(task.done, False)
        self.assertEqual(task.task, " x foo bar")
        self.assertEqual(set(task.projects), set(["+proj1", "+proj2"]))
        self.assertEqual(set(task.contexts), set(["@context"]))
        self.assertEqual(task.tags, {"tag":"value"})

        todo_line = " 2010-10-2 foo bar +proj1 +proj2 @context tag:value"
        task = Task.parse(todo_line)
        self.assertEqual(task.priority, "")
        self.assertEqual(task.create, date(2010,10,2))
        self.assertEqual(task.finish, None)
        self.assertEqual(task.done, False)
        self.assertEqual(task.task, " foo bar")
        self.assertEqual(set(task.projects), set(["+proj1", "+proj2"]))
        self.assertEqual(set(task.contexts), set(["@context"]))
        self.assertEqual(task.tags, {"tag":"value"})
Beispiel #4
0
 def test_task(self):
     """basic task parsing"""
     todo_line = "foo bar +proj1 +proj2 @context tag:value"
     task = Task.parse(todo_line)
     self.assertEqual(task.priority, "")
     self.assertEqual(task.create, None)
     self.assertEqual(task.finish, None)
     self.assertEqual(task.done, False)
     self.assertEqual(task.task, "foo bar")
     self.assertEqual(set(task.projects), set(["+proj1", "+proj2"]))
     self.assertEqual(set(task.contexts), set(["@context"]))
     self.assertEqual(task.tags, {"tag":"value"})
Beispiel #5
0
 def test_empty_line(self):
     x = Task.parse("")
     self.assertEqual(x, None)