def test_set_priority4(self): """ Add priority, while not be mistaken about todo string. """ todo = TodoBase("(A)Foo") self.assertNotEqual(todo.priority(), 'A') todo.set_priority('B') self.assertEqual(todo.priority(), 'B') self.assertTrue(re.match(r'^\(B\) \(A\)Foo$', todo.src))
def test_set_priority6(self): """ Do not set priorities on completed tasks. """ todo = TodoBase("x 2014-06-13 Foo") todo.set_priority('A') self.assertFalse(todo.priority()) self.assertEqual(todo.src, "x 2014-06-13 Foo")
def test_set_priority5(self): """ Unset priority. """ todo = TodoBase("(A) Foo") todo.set_priority(None) self.assertEqual(todo.priority(), None) self.assertTrue(re.match(r'^Foo$', todo.src))
def test_set_priority3(self): """ Test invalid priority input. """ todo = TodoBase("(A) Foo") todo.set_priority('AB') self.assertEqual(todo.priority(), 'A') self.assertTrue(re.match(r'^\(A\) Foo$', todo.src))
def test_set_priority2(self): """ Set priority to task without priority. """ todo = TodoBase("Foo") todo.set_priority('B') self.assertEqual(todo.priority(), 'B') self.assertTrue(re.match(r'^\(B\) Foo$', todo.src))
def test_set_priority1(self): """ Change priority. """ todo = TodoBase("(A) Foo") todo.set_priority('B') self.assertEqual(todo.priority(), 'B') self.assertTrue(re.match(r'^\(B\) Foo$', todo.src))
def test_set_source_text(self): todo = TodoBase("(B) Foo") new_text = "(C) Foo" todo.set_source_text(new_text) self.assertEqual(todo.src, new_text) self.assertEqual(todo.priority(),'C')
def test_set_complete1(self): todo = TodoBase("(A) Foo") todo.set_completed() today = date.today() today_str = today.isoformat() self.assertFalse(todo.priority()) self.assertEqual(todo.fields['completionDate'], today) self.assertTrue(re.match('^x ' + today_str + ' Foo', todo.src))