def test_priority(self): """priority is OK""" task_str = "(B) foo bar baz +proj1 +proj2 @context foo:bar" task = Task("foo bar baz", projects=['+proj1', '+proj2'], contexts=['@context'], tags={'foo':'bar'}) task.priority = "(B)" self.assertEqual(str(task), task_str)
def test_created_priority(self): """creation date and priority works""" task_str = "(A) 2010-10-01 foo bar baz +proj1 +proj2 @context foo:bar" task = Task("foo bar baz", projects=['+proj1', '+proj2'], contexts=['@context'], tags={'foo':'bar'}) task.create = date(2010,10,1) task.priority = "(A)" self.assertEqual(str(task), task_str)
def test_undo(self): """make sure undo works""" task = Task("foo bar", autodate=True) task.priority = 'a' task.do() task.do(False) self.assertEqual(task.finish, None) self.assertEqual(task.done, False) self.assertEqual(task.create, date.today()) self.assertEqual(task.priority, "(A)")
def test_prioritystuff(self): """Priority parsing helpers are good...""" t = Task() t.priority = "(A)" self.assertEqual(t.priority, "(A)") t.priority = "A" self.assertEqual(t.priority, "(A)") t.priority = "a" self.assertEqual(t.priority, "(A)") t.priority = "(a)" self.assertEqual(t.priority, "(A)") with self.assertRaises(Exception): t.priority = '1' with self.assertRaises(Exception): t.priority = '(a' with self.assertRaises(Exception): t.priority = 'foo' with self.assertRaises(Exception): t.priority = 'qq' with self.assertRaises(Exception): t.priority = 'ABC'