def test_get_task_index(self): m = Model() t1 = Task() t1.set_content("test content") t1.set_status(TaskStatus.DONE) t1.id = 5 m.add_task(t1) t2 = Task() t2.set_content("test content2") t2.set_status(TaskStatus.DOING) t2.id = 7 m.add_task(t2) self.assertEqual(m.get_task_index(t2), 1) self.assertEqual(m.get_task_index(t1), 0)
def test_get_task(self): m = Model() t1 = Task() t1.set_content("test content") t1.set_status(TaskStatus.DONE) t1.id = 5 m.add_task(t1) t2 = Task() t2.set_content("test content2") t2.set_status(TaskStatus.DOING) t2.id = 7 m.add_task(t2) gt1 = m.get_task(5) gt2 = m.get_task(7) self.assertEqual(gt1, t1) self.assertEqual(gt2, t2)
def test_add_task(self): m = Model() t = Task() t.set_content("test content") t.set_status(TaskStatus.DONE) t.id = 5 m.add_task(t) t.set_content("test content2") t.set_status(TaskStatus.DOING) t.id = 10 m.add_task(t) gt2 = m.get_task(5) self.assertEqual(gt2.get_status(), TaskStatus.DONE) self.assertEqual(gt2.get_content(), "test content") gt = m.get_task(10) self.assertEqual(gt.get_status(), TaskStatus.DOING) self.assertEqual(gt.get_content(), "test content2")
def test_del_task(self): m = Model() t = Task() t.set_content("test content") t.set_status(TaskStatus.DONE) t.id = 5 m.add_task(t) t.set_content("test content2") t.set_status(TaskStatus.DOING) t.id = 11 m.add_task(t) m.del_task(5) self.assertEqual(len(m.tasks), 1) gt = m.get_task(11) self.assertEqual(gt.get_status(), TaskStatus.DOING) self.assertEqual(gt.get_content(), "test content2") self.assertEqual(m.get_task(5), False)
def test_set_content(self): t = Task() t.set_content("new content") self.assertEqual(t.content, "new content")
from classModel import Model from classTask import Task, TaskStatus import debug t1 = Task() t1.set_content( """Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum""") t1.set_status(TaskStatus.DONE) t1.id = 0 t2 = Task() t2.set_content("""Just as with any string, anything between the starting and ending quotes becomes part of the string, so this example has a leading blank (as pointed out by @root45). This string will also contain both blanks and newlines.""") t2.set_status(TaskStatus.DOING) t2.id = 1 t3 = Task() t3.set_content("""If you don't want a multiline string but just have a long single line string, you can use parentheses, just make sure you don't include commas between the string segments, then it will be a tuple.""") t3.set_status(TaskStatus.TODO) t3.id = 3 t4 = Task() t4.set_content("""This section often ends up being an exceedingly long and detailed list of tasks that is tough to maintain, but even tougher for an employee to remember and apply in their day-to-day work.""")