Example #1
0
class TodoListCleanDependencyTester(TopydoTest):
    def setUp(self):
        super(TodoListCleanDependencyTester, self).setUp()

        self.todolist = TodoList([])
        self.todolist.add("Bar p:1")
        self.todolist.add("Baz p:1 id:2")
        self.todolist.add("Buzz p:2")

    def test_clean_dependencies(self):
        self.todolist.clean_dependencies()

        self.assertFalse(self.todolist.todo(1).has_tag("p"))
        self.assertFalse(self.todolist.todo(2).has_tag("p"))
        self.assertTrue(self.todolist.todo(2).has_tag("id", "2"))
        self.assertTrue(self.todolist.todo(3).has_tag("p", "2"))
Example #2
0
class TodoListCleanDependencyTester(TopydoTest):
    def setUp(self):
        super(TodoListCleanDependencyTester, self).setUp()

        self.todolist = TodoList([])
        self.todolist.add("Bar p:1")
        self.todolist.add("Baz p:1 id:2")
        self.todolist.add("Buzz p:2")

    def test_clean_dependencies(self):
        self.todolist.clean_dependencies()

        self.assertFalse(self.todolist.todo(1).has_tag('p'))
        self.assertFalse(self.todolist.todo(2).has_tag('p'))
        self.assertTrue(self.todolist.todo(2).has_tag('id', '2'))
        self.assertTrue(self.todolist.todo(3).has_tag('p', '2'))
Example #3
0
class TodoListCleanDependencyTester(TopydoTest):
    """
    Tests for cleaning up the graph:

    * Transitive reduction
    * Remove obsolete id: tags
    * Remove obsolete p: tags
    """

    def setUp(self):
        super().setUp()
        self.todolist = TodoList([])

    def test_clean_dependencies1(self):
        """ Clean p: tags from non-existing parent items. """
        self.todolist.add("Bar p:1")
        self.todolist.add("Baz p:1 id:2")
        self.todolist.add("Buzz p:2")

        self.todolist.clean_dependencies()

        self.assertFalse(self.todolist.todo(1).has_tag('p'))
        self.assertFalse(self.todolist.todo(2).has_tag('p'))
        self.assertTrue(self.todolist.todo(2).has_tag('id', '2'))
        self.assertTrue(self.todolist.todo(3).has_tag('p', '2'))

    def test_clean_dependencies2(self):
        """ Clean p: items when siblings are still connected to parent. """
        self.todolist.add("Foo id:1")
        self.todolist.add("Bar p:1")
        self.todolist.add("Baz p:1 id:2")
        self.todolist.add("Buzz p:1 p:2")

        self.todolist.clean_dependencies()

        self.assertFalse(self.todolist.todo(4).has_tag('p', '1'))
        self.assertTrue(self.todolist.todo(1).has_tag('id', '1'))
        self.assertTrue(self.todolist.todo(2).has_tag('p', '1'))

    def test_clean_dependencies3(self):
        """ Clean id: tags from todo items without child todos. """
        self.todolist.add("Foo id:1")

        self.todolist.clean_dependencies()

        self.assertFalse(self.todolist.todo(1).has_tag('id'))
        self.assertFalse(self.todolist.todo_by_dep_id('1'))
Example #4
0
class TodoListCleanDependencyTester(TopydoTest):
    """
    Tests for cleaning up the graph:

    * Transitive reduction
    * Remove obsolete id: tags
    * Remove obsolete p: tags
    """

    def setUp(self):
        super().setUp()
        self.todolist = TodoList([])

    def test_clean_dependencies1(self):
        """ Clean p: tags from non-existing parent items. """
        self.todolist.add("Bar p:1")
        self.todolist.add("Baz p:1 id:2")
        self.todolist.add("Buzz p:2")

        self.todolist.clean_dependencies()

        self.assertFalse(self.todolist.todo(1).has_tag('p'))
        self.assertFalse(self.todolist.todo(2).has_tag('p'))
        self.assertTrue(self.todolist.todo(2).has_tag('id', '2'))
        self.assertTrue(self.todolist.todo(3).has_tag('p', '2'))

    def test_clean_dependencies2(self):
        """ Clean p: items when siblings are still connected to parent. """
        self.todolist.add("Foo id:1")
        self.todolist.add("Bar p:1")
        self.todolist.add("Baz p:1 id:2")
        self.todolist.add("Buzz p:1 p:2")

        self.todolist.clean_dependencies()

        self.assertFalse(self.todolist.todo(4).has_tag('p', '1'))
        self.assertTrue(self.todolist.todo(1).has_tag('id', '1'))
        self.assertTrue(self.todolist.todo(2).has_tag('p', '1'))

    def test_clean_dependencies3(self):
        """ Clean id: tags from todo items without child todos. """
        self.todolist.add("Foo id:1")

        self.todolist.clean_dependencies()

        self.assertFalse(self.todolist.todo(1).has_tag('id'))
        self.assertFalse(self.todolist.todo_by_dep_id('1'))