def test_list_open_items_returns_inprogress_items(self): list = todo.List() idx = list.add_item("summary") list.lookup(idx).inprogress() self.assertEqual({idx: list.lookup(idx)}, list.open_items()) list.lookup(idx).complete() self.assertEqual({}, list.open_items())
def test_list_size_increases_when_new_item_added(self): list = todo.List() list.add_item("summary") self.assertEqual(1, list.total_count())
def test_remove_item_when_item_not_exists(self): list = todo.List() list.remove_item(999)
def test_remove_item_when_item_exists(self): list = todo.List() idx = list.add_item("summary") list.remove_item(idx) self.assertEqual(None, list.lookup(idx))
def test_add_item_returns_element_index(self): list = todo.List() summary = "summary1" id = list.add_item(summary) self.assertEqual(summary, list.lookup(id).description())
def test_new_list(self): list = todo.List() self.assertEqual(0, list.total_count())
def test_returns_none_when_missing_element(self): list = todo.List() self.assertEqual(None, list.lookup(999))
def test_items_do_not_collide(self): list = todo.List() list.add_item("summary") self.assertEqual(1, list.total_count()) list.add_item("summary") self.assertEqual(2, list.total_count())
def test_list_todo_items_returns_todo_items(self): list = todo.List() idx = list.add_item("summary") self.assertEqual({idx: list.lookup(idx)}, list.todo_items()) list.lookup(idx).inprogress() self.assertEqual({}, list.todo_items())
def test_list_todo_item_shows_number_of_todo_items(self): list = todo.List() list.add_item("summary") self.assertEqual(1, list.total_count())