예제 #1
0
 def add_empty_task(self):
     m = Model()
     self.assertEqual(m.add_empty_task(), 0)
     m.add_empty_task()
     m.add_empty_task()
     m.add_empty_task()
     self.assertEqual(m.add_empty_task(), 4)
     t = Task()
     t.id = 5
     m.add_task(t)
     t.id = 6
     m.add_task(t)
     self.assertEqual(m.add_empty_task(), 7)
예제 #2
0
    def test_eq(self):
        t1 = Task()
        t1.content = "content one"
        t1.status = TaskStatus.TODO
        t1.id = 5

        t2 = Task()
        t2.content = "content one"
        t2.status = TaskStatus.DOING
        t2.id = 7

        self.assertNotEqual(t1, t2)
        t2.id = 5
        self.assertEqual(t1, t2)
예제 #3
0
    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)
예제 #4
0
    def find_free_id(self):
        m = Model()
        t = Task()
        t.id = 1
        m.add_task(t)
        t.id = 3
        m.add_task(t)
        t.id = 6
        m.add_task(t)
        t.id = 9
        m.add_task(t)

        self.assertEqual(m.find_free_id(), 0)

        t.id = 0
        m.add_task(t)
        self.assertEqual(m.find_free_id(), 2)
예제 #5
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)
예제 #6
0
    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")
예제 #7
0
    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)
예제 #8
0
 def add_empty_task(self):
     t = Task()
     t.id = self.find_free_id()
     self.tasks.append(t)
     return t.id
예제 #9
0
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.""")