예제 #1
0
 def test_add_child2(self):
     """PM Adding a child implies root is a parent for the child"""
     root = Task("Root Task")
     pm = ProjMan(root)
     child = Task("Child Task")
     pm.add_child(child)
     self.assertIn(root, child.prerequisites)
예제 #2
0
 def test_add_child(self):
     """PM Can add a child"""
     root = Task("Root Task")
     pm = ProjMan(root)
     child = Task("Child Task")
     pm.add_child(child)
     self.assertIn(child, root.dependants)
예제 #3
0
    def test_list_tasks_duplicates(self):
        """Listing all tasks in a project, no duplicates"""
        # Create Root
        root = Task("Root Task")
        # Create Project
        pm = ProjMan(root)
        # Append Children
        child1 = Task("Child Task 1")
        pm.add_child(child1)

        child2 = Task("Child Task 2")
        pm.add_child(child2)

        task_list = pm.list_tasks()
        self.assertEqual(3, len(task_list))
예제 #4
0
    def test_list_tasks(self):
        """Listing all tasks in a project"""
        # Create Root
        root = Task("Root Task")
        # Create Project
        pm = ProjMan(root)
        # Append Children
        child1 = Task("Child Task 1")
        pm.add_child(child1)

        child2 = Task("Child Task 2")
        pm.add_child(child2)

        task_list = pm.list_tasks()
        self.assertTrue(
            root in task_list and
            child1 in task_list and
            child2 in task_list)