def _createMockFile(self):
     today = today = date.today().strftime('%Y-%m-%d')
     file = File()
     file.tasks.append(todolib.Task('my task1 @context1'))
     file.tasks.append(todolib.Task('my task2 @context1 @context2'))
     file.tasks.append(
         todolib.Task('due:' + today + ' my task3 +project1 @context2'))
     file.tasks.append(todolib.Task('due:' + today + ' my task4'))
     return file
示例#2
0
 def test_05(self):
     # Test task with a single project at the center
     task = todolib.Task('this is my task +project and some more words')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<tt>&nbsp;&nbsp;&nbsp;</tt>this is my task <font style="color:#64AAD0">+project</font> and some more words'
     )
示例#3
0
 def test_03(self):
     # Test task with a single context at the center
     task = todolib.Task('this is my task @context and some more words')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<tt>&nbsp;&nbsp;&nbsp;</tt>this is my task <font color="green">@context</font> and some more words'
     )
示例#4
0
 def test_04(self):
     # Test task with a single project at the end
     task = todolib.Task('this is my task +project')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<tt>&nbsp;&nbsp;&nbsp;</tt>this is my task <font style="color:#64AAD0">+project</font>'
     )
示例#5
0
 def test_02(self):
     # Test task with a single context at the end
     task = todolib.Task('this is my task @context')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<tt>&nbsp;&nbsp;&nbsp;</tt>this is my task <font color="green">@context</font>'
     )
示例#6
0
 def test_12(self):
     # Test task with an invalid due date
     task = todolib.Task('this is my task due:2014-04')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<tt>&nbsp;&nbsp;&nbsp;</tt>this is my task <b><font style="color:red">*** Invalid date format, expected: YYYY-mm-dd! due:2014-04 ***</font></b>'
     )
示例#7
0
 def test_15(self):
     # Test task with solely an URL
     task = todolib.Task(
         'https://github.com/mNantern/QTodoTxt/archive/master.zip')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<tt>&nbsp;&nbsp;&nbsp;</tt><a href="https://github.com/mNantern/QTodoTxt/archive/master.zip">https://github.com/mNantern/QTodoTxt/archive/master.zip</a>'
     )
示例#8
0
 def test_06(self):
     # Test task with a single context and a single project
     task = todolib.Task(
         'this is my task @context and +project and some more words')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<tt>&nbsp;&nbsp;&nbsp;</tt>this is my task <font color="green">@context</font> and '
         '<font style="color:#64AAD0">+project</font> and some more words')
示例#9
0
 def test_14(self):
     # Test task with an URL
     task = todolib.Task(
         'Download https://github.com/mNantern/QTodoTxt/archive/master.zip and extract'
     )
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<tt>&nbsp;&nbsp;&nbsp;</tt>Download <a href="https://github.com/mNantern/QTodoTxt/archive/master.zip">https://github.com/mNantern/QTodoTxt/archive/master.zip</a> and extract'
     )
示例#10
0
 def test_07(self):
     # Test task with a two contexts and a three projects
     task = todolib.Task(
         'this is my task @context1 and @context2 and +project1 +project2 and +project3 some more words'
     )
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<tt>&nbsp;&nbsp;&nbsp;</tt>this is my task <font color="green">@context1</font> and <font color="green">@context2</font> and <font style="color:#64AAD0">+project1</font> <font style="color:#64AAD0">+project2</font> and <font style="color:#64AAD0">+project3</font> some more words'
     )
示例#11
0
 def createTask(self):
     (text, ok) = self._task_editor_service.createTask()
     if ok and text:
         self._settings.load()
         if self._settings.getCreateDate():
             text = self._addCreationDate(text)
         task = todolib.Task(text)
         self._view.addTask(task)
         self._view.clearSelection()
         self._view.selectTask(task)
         self.taskCreated.emit(task)
示例#12
0
 def _createMockFile(self):
     file = todolib.File()
     file.tasks.append(todolib.Task('my task1 @context1'))
     file.tasks.append(todolib.Task('my task2 @context1 @context2'))
     file.tasks.append(todolib.Task('my task3 +project1 @context2'))
     return file
示例#13
0
 def test_08(self):
     # Test task with priority A
     task = todolib.Task('(A) this is my task')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<font color="red"><tt>&nbsp;A&nbsp;</tt></font>this is my task')
示例#14
0
 def test_01(self):
     # Simple task should return simple html
     task = todolib.Task('this is my task')
     self.assertEqual(self.htmlizer.task2html(task),
                      '<tt>&nbsp;&nbsp;&nbsp;</tt>this is my task')
示例#15
0
 def test_11(self):
     # Test task with priority D
     task = todolib.Task('(D) this is my task')
     self.assertEqual(self.htmlizer.task2html(task),
                      '<tt>&nbsp;D&nbsp;</tt>this is my task')
示例#16
0
 def test_10(self):
     # Test task with priority C
     task = todolib.Task('(C) this is my task')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<font color="navy"><tt>&nbsp;C&nbsp;</tt></font>this is my task')
示例#17
0
 def test_09(self):
     # Test task with priority B
     task = todolib.Task('(B) this is my task')
     self.assertEqual(
         self.htmlizer.task2html(task),
         '<font color="green"><tt>&nbsp;B&nbsp;</tt></font>this is my task')