Commit b3817f3e authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add method to erase the todo list.

This should not be done with TodoList.delete(), since it may
remove dependency information.
parent d6f1a5e0
......@@ -155,6 +155,16 @@ class TodoList(object):
self.dirty = True
def erase(self):
"""
Erases all todos from the list.
Not done with self.delete to prevent dependencies disappearing from the
todo items.
"""
self._todos = []
self.dirty = True
def count(self):
""" Returns the number of todos on this list. """
return len(self._todos)
......
......@@ -175,6 +175,12 @@ class TodoListTester(unittest.TestCase):
self.assertFalse(self.todolist.is_dirty())
def todo_erase(self):
self.todolist.erase()
self.assertEquals(self.todolist.count(), 0)
self.assertTrue(self.todolist.is_dirty())
class TodoListDependencyTester(unittest.TestCase):
def setUp(self):
self.todolist = TodoList.TodoList([])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment