示例#1
0
 def test_del_priority(self):
     test_str = "(B) 2012-08-27 @home Xbox repair"
     test_item = TodoItem(test_str)
     test_item.priority = None
     self.assertIsNone(test_item.priority)
     self.assertEqual("2012-08-27 Xbox repair @home",
                      test_item.todo_txt_line)
示例#2
0
 def test_set_priority_from_scratch(self):
     test_str = "2012-09-15 bar baz @home"
     test_item = TodoItem(test_str)
     self.assertIsNone(test_item.priority)
     test_item.priority = "D"
     self.assertIsNotNone(test_item.priority)
     self.assertEquals("(D) " + test_str, test_item.todo_txt_line)
示例#3
0
 def test_mark_done(self):
     test_str = "(B) 2012-08-27 @home Xbox repair"
     done_item = TodoItem("x " + TodoItem.curr_date_str() +
                         " 2012-08-27 @home Xbox repair")
     test_item = TodoItem(test_str)
     test_item.done = True
     test_item.priority = None
     self.assertEqual(test_item.__dict__, done_item.__dict__)
示例#4
0
 def cmd_add(self):
     priarg = self.cmd.replace("add", "")
     new_td = TodoItem(self.addargs)
     new_td.priority = priarg
     new_td.create_today()
     #print "Adding " + str(new_td)
     self.td_file.append(new_td)
     self.save()
     self.cmd_ls()
示例#5
0
 def test_set_priority_exists(self):
     test_str = "(A) 2012-09-15 bar baz @home"
     test_item = TodoItem(test_str)
     self.assertIsNotNone(test_item.priority)
     test_item.priority = "D"
     self.assertIsNotNone(test_item.priority)
     self.assertEquals("D", test_item.priority)
     self.assertEquals("(D) 2012-09-15 bar baz @home",
                       test_item.todo_txt_line)
示例#6
0
文件: tdg.py 项目: dandrzejewski/tdg
 def save(self):
     self.set_status("Adding new item: ")
     new_item = TodoItem()
     new_item.priority = self.new_priority.get()
     if new_item.priority == "":
         new_item.priority = None
     new_item.context = self.new_context.get()
     if new_item.context == "" or new_item.context == "None":
         new_item.context = None
     new_item.task = self.new_task.get()
     new_item.creation_date = self.new_date.get()
     if new_item.creation_date == "":
         new_item.creation_date = None
     self.set_status("Adding new item: " + str(new_item))
     self.active_td_file().append(new_item)
     self.set_status(
         "Adding new item: " + str(new_item) + " ... save complete")
     self.reset_ui()