Commit c31aa9df authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add (failing) test for checking the number of a newly added todo.

When using the add_todo method, the todo number is not set.
It needs some refactoring to move the number property to the
TodoList, instead of being a property of Todo.
parent 874a8f3b
...@@ -4,6 +4,7 @@ import datetime ...@@ -4,6 +4,7 @@ import datetime
import re import re
import unittest import unittest
import Todo
import TodoFile import TodoFile
import TodoList import TodoList
...@@ -126,6 +127,14 @@ class TodoListTester(unittest.TestCase): ...@@ -126,6 +127,14 @@ class TodoListTester(unittest.TestCase):
self.assertTrue(self.todolist.todo_by_dep_id('1')) self.assertTrue(self.todolist.todo_by_dep_id('1'))
self.assertFalse(self.todolist.todo_by_dep_id('2')) self.assertFalse(self.todolist.todo_by_dep_id('2'))
def test_todo_number(self):
todo = Todo.Todo("No number")
self.todolist.add_todo(todo)
todo = self.todolist.todo(6)
self.assertIsInstance(todo, Todo.Todo)
self.assertEquals(todo.text(), "No number")
class TodoListDependencyTester(unittest.TestCase): class TodoListDependencyTester(unittest.TestCase):
def setUp(self): def setUp(self):
self.todolist = TodoList.TodoList([]) 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