예제 #1
0
 def test_creation_date_parsing(self):
     creation_dates = [
         '2011-03-02 Document +TodoTxt task format',
         '(A) 2011-03-02 Call Mom',
     ]
     no_creation_date = '(A) Call Mom 2011-03-02'
     t = todotxt.Task(no_creation_date)
     self.assertEqual(t.creation_date, None)
     for e in creation_dates:
         t = todotxt.Task(e)
         self.assertEqual(str(t.creation_date), '2011-03-02')
예제 #2
0
 def test_completed_task_parse(self):
     complete_task = 'x 2011-03-03 Call Mom'
     incomplete_tasks = [
         'xylophone lesson',
         'X 2012-01-01 Make resolutions',
         '(A) x Find ticket prices',
     ]
     t = todotxt.Task(complete_task)
     self.assertEqual(t.completion, True)
     for e in incomplete_tasks:
         t = todotxt.Task(e)
         self.assertEqual(t.completion, False)
예제 #3
0
 def test_priority_parsing(self):
     priority = '(A) Call Mom'
     no_priorities = [
         'Really gotta call Mom (A) @phone @someday',
         '(b) Get back to the boss',
         '(B)->Submit TPS report',
     ]
     t = todotxt.Task(priority)
     self.assertEqual(t.priority, 'A')
     for e in no_priorities:
         t = todotxt.Task(e)
         self.assertEqual(t.priority, None)
예제 #4
0
 def test_context_and_project_parse(self):
     family_plah_projects_and_iphone_phone_contexts = '(A) Call Mom +Family +PeaceLoveAndHappiness @iphone @phone'
     no_contexts = 'Email SoAndSo at [email protected]'
     no_projects = 'Learn how to add 2+2'
     t = todotxt.Task(family_plah_projects_and_iphone_phone_contexts)
     self.assertListEqual(t.context_tags, ['iphone', 'phone'])
     self.assertListEqual(t.project_tags,
                          ['Family', 'PeaceLoveAndHappiness'])
     t = todotxt.Task(no_contexts)
     self.assertEqual(t.context_tags, [])
     t = todotxt.Task(no_projects)
     self.assertEqual(t.project_tags, [])
예제 #5
0
 def test_completion_with_date(self):
     t = todotxt.Task()
     t.set_date('2017-02-02')
     t.mark_complete(set_date=True)
     self.assertEqual(
         str(t), 'x {} {}'.format(datetime.datetime.now().date(),
                                  '2017-02-02'))
     t.mark_complete(unmark=True)
     self.assertEqual(str(t), '2017-02-02')
예제 #6
0
 def test_priority(self):
     t = todotxt.Task()
     t.set_priority()
     self.assertEqual(str(t), '(A)')
     t.increase_priority()
     self.assertEqual(str(t), '(A)')
     t.decrease_priority()
     t.decrease_priority()
     self.assertEqual(str(t), '(C)')
     t.increase_priority()
     self.assertEqual(str(t), '(B)')
     t.set_priority('Z')
     self.assertEqual(str(t), '(Z)')
     t.decrease_priority()
     self.assertEqual(str(t), '(Z)')
예제 #7
0
 def test_completion(self):
     t = todotxt.Task()
     t.mark_complete(set_date=True)
     self.assertEqual(str(t), 'x {}'.format(datetime.datetime.now().date()))
예제 #8
0
 def test_date(self):
     t = todotxt.Task()
     t.set_date('2017-01-30')
     self.assertEqual(str(t), '2017-01-30')
예제 #9
0
 def test_due_date_special_parse(self):
     all_possibilities = "x (A) 2016-05-20 2016-04-30 measure space for +chapelShelving @chapel due:2016-05-30"
     t = todotxt.Task(all_possibilities)
     self.assertEqual(t.special_tags, [('due', '2016-05-30')])
예제 #10
0
 def test_completed_date_parse(self):
     completed_date_after_created_date = "x 2011-03-02 2011-03-01 Review Tim's pull request +TodoTxtTouch @github"
     t = todotxt.Task(completed_date_after_created_date)
     self.assertEqual(t.completion, True)
     self.assertEqual(str(t)[0:2], 'x ')